TLDR: napisałem swój silnik blogowania w mniej niż 100 linii kodu.
UPDATE: zgodnie z zapowiedzią, napisałem artykuł jak blog powstawał: można przeczytać na medium jak i na moim blogu ps: jak na medium czytacie mając premke to mi szekle lecą.
Ostatnio znudził mi się mój szablon na blogu a sam silnik, którego używałem, wydawał się dla mnie za duży. Potrzebowałem czegoś o wiele prostszego. Prostego szablonu, prostego silnika do renderowania. Niestety teraz mamy taką modę, że z małego landinga page developerzy potrafią zrobić 30 mb SPA, bo przecież wszędzie musi być react, trzysta bibliotek js i milion zdjęć. O ile react jest świetnym narzędziem i ma swoje zastosowania, to nie wszędzie powinno się go wciskać.
Cóż, zatem siadłem jednego wieczoru i parę godzin później powstał braindead - mój własny braindead simple static site generator
. Początkowa działająca wersja, mająca wszystkie potrzebne mi featury, zmieściła mi się w 100 linijkach kodu. Teraz troszkę dobudowałem i dodałem nieco komentarzy więc jest ich około 150, ale wciąż uważam to za niezły wynik jak na silnik dla mojego bloga, który wspiera markdown, kolorowanie składni, htmla, tabelki w markdownie i kilka innych rzeczy.
Magia się tam nie dzieje żadna - Jinja, Markdown, Toml, Pygments.
Szablon, którego używam waży jakieś 10KB, strona ładuje się jak pierun normalnie. Nie ma JSa. I to mi się podoba. W każdym razie - kod jest na repo, jakby się ktoś chciał pobawić, to zapraszam. Paczkę można ściągnąć z pypi pip install braindead
. Jak używać jest w pliku readme na repo. Demo na blogu https://grski.pl/
Jak komuś mój szablon nie pasuje, to można swój własny napisać :D
Domyślny wygląda tak:
Ładowanie bez cache:
W sumie chyba będę to trochę rozwijał po godzinach.
Za niedługo pewnie skrobnę wpis o procesie tworzenia.
Why I love engineering part N
Otóż w Pythonie jest sobie taka paczuszka - arg
. Jest też druga - args
.
Różnią się niewiele, ale różnią się.
Któraś z paczek, której używałem, zaczęła mi się wywalać - informując, że nie ma paczki arg
. Cóż, zatem ja naiwiny instaluję arg
.
DAlej nie działa. Arg znajduje, ale kolejny problem Tym razem interfejs się nie zgadzał, zależności brakowało elementów itd. Czyżby jakaś backwards-incompatibile nowa wersja arg
? Hmmmm, ciekawe.
Chwila szukania, okazuje się, że nie. To nie to. Nowych releasów nie było w tym czasie.
Szukam głębiej.
Okazuje się, że paczka args
, nie arg
zawiera w sobie też swoją wersję arg
, która jest zupełnie czym innym. Oczywiście moja zależność zależała od arg
z args
.
Zatem, jabky się tego można spodziewać, instalując args
dostaje args
ale i również arg
, które jest zupełnie różne od tego, jakie otrzmyujemy, gdy zainstalujemy bezpośrednio arg
.
Czyli pip install arg
daje nam po prostu arg
natomiast pip install args
daje nam args oraz jakąś dziwną wersję arg
.
Makes sense, prawda?
:)
@Afish: coś w stylu "wszystkie drogi prowadzą do rozwiązania"? No niby masz rację, ale jednak to, że po drodze expisz (w 99% tak, no chyba, że jesteś najlepszy z najlepszych) to tylko wyjdzie na dobre, bo exp (nabyty w trakcie rozwiązywania wątków pobocznych) + exp z wątku głównego = większy exp końcowy;
Pewnie, jest w tym wartość, ale lepiej byłoby czas poświęcony na naprawianie konfliktów paczek przeznaczyć na expienie w tworzeniu architektury (czy co tam kogo interesuje). A swoją opinię opieram na projektach, w których spędziłem nierzadko kilka tygodni na rozwiązywaniu konfliktów i kompilowaniu kodu, to jest czas z mojej perspektywy stracony, bo mogłem te tygodnie spędzić bardziej wartościowo. Nauczyłem się przy tym różnych rzeczy związanych z systemami pakietów w konkretnych technologiach, czy z narzędziami do budowania kodu w konkretnych platformach, ale jest to 1) wiedza średnio przydatna w innych platformach (przydatny jest koncept, zazwyczaj nieprzydatne są szczegóły) 2) wiedza niewpływająca na rozwiązanie problemu biznesowego (gdyby nie było konfliktów paczek, to moja aplikacja wyglądałaby dokładnie tak samo, więc wiedza o rozwiązywaniu konfliktów nie dała wartości biznesowej) 3) nudna robota (fajne jest zaglądanie pod spód w ogólności, niefajne jest naprawianie konfliktów tygodniami). Od razu zaznaczę, że nie jest to spowodowane jakością kodu, tylko poziomem skomplikowania aplikacji (dosłownie tysiące zależności).
https://compedu.stanford.edu/codeinplace/announcement/
Kurs ze Stanfordu - wprowadzenie do programowania z pythonem. Czym się to różni od standardowych kursów typu cs50? Otóż ten kurs będzie prowadzony na żywo. Raz na tydzień, razem z grupą innych kursantów, będziecie spędzać czas i uczyć się z dedykowanym nauczycielem, prawdopodobnie ze stanfordu.
This experience is different from typical free online courses in that, in addition to using online resources, you will meet (via videoconferencing) in a small group, once a week, with someone on the teaching team.
To świetna okazja, by nauczyć się programowania. Wcześniejsze doświadczenie niewymagane. Wśród prowadzących głównie stanfordzka śmietanka kadrowa, także polecam :)
Ostatnio sobie napisałem artykulik taki, trochę ciężki, osobisty, ale potrzebny. Mianowicie o tym jak to jest trochę zawalać robotę mimo sprzyjających okoliczności. Poczytać można na medium, u mnie na blogu, ale, że nie lubię do końca tak samych linków wklejać, to też i tutaj przeczytać można.
Wydaje mi się, że temat znajomy każdemu, zwłaszcza jak kto tak smarkaty, jak ja, ale nie wiem, bo raczej się o takich rzeczach nie pisze.
Poniżej wklejony art
Today I'm going to ponder a bit about failure.
My failure to be exact. I think it's a rare topic in this day and age, where everyone and everything is perfect, life is sculpted
to fit a certain image and you are only allowed to be a winner
.
It's more of a way of sorting stuff out for me rather than something meaningful, but that might be somehow insightful in itself as it's quite an honest review of my thought process and experiences.
Lately, I've been working less.
I couldn't focus, didn't have any love for the project I was working on, or for the company, for anyone actually. Including myself.
I felt burned out and miserable. I tried working, I've sat in front of the keyboard only to code nothing and just stare into the abyss. And so the abyss stared back at me bringing me to the edge.
Edge of what exactly? A cluster of failures.
There was a time when I thought I'm disciplined, passionate enough about my work. Professional enough to separate my private life and work. And it won't change, like ever. Now the only commentary I have regarding that which is as follows:
You fool
I've come to realize that we are all only humans. My arrogance has driven me astray. For some time I saw myself as an input-output machine. A pure function if you will. You input arguments, you get predictable output. Always.
As stupid as it sounds it was my belief.
I think a lot of young engineers might be thinking similarly. Maybe I'm wrong here, but I doubt that. As engineers, we tend to make things scientific, tangible, measurable. That's fine. I just went too far with that I'd say.
It resulted in me not delivering. For quite some time. Which was surprising. I have a dream job. I work remotely, get a handsome salary for it, my coworkers are top talents, who are also good people, projects are interesting, written mostly from scratch using cool, state-of-the-art technology. Like seriously. What's going on dude? Yet here I was, sick and tired of it. How come?
I thought there must be something wrong with what we do, with how we do. I searched for that something, yet couldn't find it in the team, in the projects, in the company, in founders. Nowhere. Until I looked at myself that is.
Life lately hasn't been too kind to me. Problems with my health, issues with the govt, technical difficulties with the tools I use, moving out to another place and finally something that broke the camels back, abandonment of different ideals I held, irresistable void close, one's illness. The stress it brings. The uncertainty. Not going into the details here, but it ain't no piece of cake. Dealing with all of that took its toll on me and this in turn took its toll on my performance at work.
It was surprising to me. Same as for how long I didn't see it and kept looking elsewhere.
For quite some time I was quiet about it until it got bad enough that It started affecting not only me but also those around. My teammates got worried, distracted. It turns out some of them genuinely care about me hence they got anxious. Not about my work, about me.
I found that out once I had a feedback talk with our founders. It was a tough call. Very. But even more so needed. It let me realize a lot of stuff.
First off it didn't feel like it was the or else. Talk. I felt care instead. I'm young and naive by definition and maybe they just got worried about not enough stuff delivered which equals less money, yet somehow I'm almost sure that it's not the case, but hey. That's just me and that's not how it felt.
What struck me then was a sentence one of our founders has authored.
Embrace and heal, then just enjoy the ride, because ours is an amazing one.
A small light bulb went off in my head or started glowing. But then the explosion happened when I heard another thing.
Olaf you are underperforming. We are worried. We expect way more from you, bit more than from others.
I know this probably sounds like something you say to all the employees, but I don't care. I love a challenge. I love to perform. To exceed expectations. To be a star. Shining brightly.
Bam. It shone like a sun then, the light bulb in my head. At least later, because at first, I got a bit annoyed and sad. I knew it was the truth but my ego is huge and volatile. I at least know about it so I showed some empathy and looked at the matter from another perspective after listening to their worries. Objectively speaking they were right.
I felt disappointed nonetheless. About myself. It's hard to hear from people who are the role models for you, that you are failing. And it was the case here.
We have three founders. Two of which are examples for me in technical perspective and social perspective, respectively. The third one is way too far ahead, he's a visionary. Swimming in another galaxy if you will, so I don't quite get him fully yet, but still respect him and his skills at least. Anyway.
Hearing from such people something like that... It's a blow. But one that awakens you. Or makes you spiteful and vengeful. It depends on if you have the humility to humble yourself for a second at least.
In my case thankfully, I managed to find some.
As an engineer, I have to look at the data. And the data was merciless.
The problem laid within me, not others. And when I looked back to my previous work experiences, it turns out that it's the case most of the time.
Here a quote came to my mind immediately, one that is often said by Sebastian, one of our founders, it may not be exact but it goes like:
Our work is not about coding at all. Technical difficulties are easy to solve, most of the time where you have problems are human issues. This isn't about coding at all.
It always rang true, yet that day more than ever.
So I had to do something. Because despite the care and trust I felt, I knew one thing. Business is business. If your pleas and help offers do not work then sooner or later, you have let that person go. I wouldn't like that to happen to me.
And hence this article - it is a form of retrospective for me or something like that. A way of summing up my thought and reflecting, improving.
Okay, tough stuff happened, it impacted my work and stuff. Yeah, crap happens, what about it? Isn't it obvious that it's a part of life?
Si senior. It is. What about it? ...Nothing. I have to move on as I cannot control the whole reality and what happens. It's the contrary.
During the day I try to be a stoic. I fail at it miserably most of the time and end up in a spiral of hedonism along the way, hoping to break the endless cycle someday.
One of the firmest beliefs I have is that reality can be divided into three categories.
I fell into the trap of caring too much about things from the last category, which is only a recipe for a disaster. I had to internalize this truth even more and come to terms with it. Once I did…
It may sound funny but, it all went away. I'll deal with it all. I have to. Or I won't, why worry though, why be miserable. It wasn't like a magic click went off in my head, but at least I got some will to get things done.
That day went by just like that - on me thinking about stuff like that, I resolved some of my issues. The worst ones - internal.
Then, if it wasn't enough, the next day I woke up to a massage from two of founders, privately asking if they can somehow help, offering. Privately, not work-related.
That moved me, I have to admit.
After that, I sat down and did twice as much work in one day as for the past week. Literally, twice, I checked the work log and hours spent working.
I started small, but started nonetheless. Then it kinda snowballed from there.
What changed? My mindset. Because I reflected but also because of another thing. The awareness that people care and I impact them daily.
It's very powerful. Even if you do not like yourself very much, you are full of vices, chances are you at least shallowly like your teammates. When you realize your actions affect innocent people, well, you just get way more incentive to improve, to care. If not about yourself, about them. Start that way at least. Then by doing that you may change, quite much actually, until one day you might find yourself bearable enough to actually like yourself. Unless you are a sociopath that is.
That this saying we are a team is not an empty slogan in our company. Because we are a team. We should and can help each other out. It feels amazing.
There's that saying
You come into the company because of the company, you leave because of the boss.
Turns out you can also stay because of the boss let's say.
Founders are what makes or breaks a company. So are its people. I realized how lucky I am to be working with the people I do work with.
Some will say I'm just sucking up here. Well, screw off. Those who know me are aware that I give exactly zero damns and tell it like it is. So this ain't about that.
It's about getting better and being grateful, honest and humble.
So first off, thank you to all my teammates, especially one, you know who you are :), thank you to founders. I'm grateful for what you do I just not always know how to show it.
The second thing I just learned that there are things in private life that will affect my work. I need to communicate those right away instead of keeping it to myself. Otherwise, people may start assuming things if they don't have the context. And they may assume things which you wouldn't like.
Third, if you work in a good company, there is a team behind you, a team of which you are a part of. A team that will help you. Not only in work it turns out. But in human things as well.
Fourth, we are nodes in a network. We are all connected - even more so at work. If you - one of the nodes start malfunctioning, the overall stability of the whole network goes down making it more probable that it all will go down, detoriating other nodes too, which then ignite a snowball effect. I started spiraling, but instead of spiraling downwards and dragging everyone down with me, I managed to set the trend upwards and also move other people up a bit. And it's amazing.
It's, I think, very important lessons. That what you do, and how YOU feel, does not only affect you. You, in fact, matter. Please remember that. This article has a word team in its title. It is not without a reason.
We are all important members of our teams. We affect everything. Hence, let's never get arrogant and realize that. No matter how bad/good your team is. You can always drag people lower or higher. It's up to you. Realize that.
Once you do - there's great power awaiting you.
Positive feedback loop.
And lastly - I apologize. To myself and you all, my teammates.
I know that for some of you this article may be obvious, cheesy and naive, but hey! I'm just a young kid trying to find the way in this crazy world.
Again, thank you all and enjoy the ride.
Bit-
we are experiencing an incident bucket.
jak zwykle w formie. Końcówka tygodnia i cyk.
https://bitbucket.status.atlassian.com/incidents/1wpbk01hsptm
Ostatnio narzekałem na overenineering deployu zmian w html w pewnym projekcie
Uptejd jest następujący: siadłem, przeorałem wszystko. Jedno repo mniej.
Instrukcja z ~30 kroków skróciła się do:
Pare godzinek i nie trzeba się już irytować. Czasem śmieszy mnie jak my, ludzie, sami sobie życie utrudniamy, bo... W sumie nie wiem dlaczego.
@furious programming: euro po 4.60 to i się powodzi, na barbera wreszcie starczyło
Klaun napisał(a): Kryzys odwołany, bo mamy oferty od hindusów dla forumowicza!!! Jes...
Ogarnij to co potrzebne pod rekrutacje i ganiaj do roboty. Jak dobrze pójdzie zanim...
Ogarnij to co potrzebne pod rekrutacje i ganiaj do roboty. Jak dobrze pójdzie zanim...
Ogarnij to co potrzebne pod rekrutacje i ganiaj do roboty. Jak dobrze pójdzie zanim...
@szatkus1: zakładasz, że ktoś posiada zakładkę 'wykształcenie/edukacja' w CV :) na m...
@Seken: tego, kto ma lepsze projekty i CV Czego jestem dowodem, w końcu dostałem pra...
Jako że oportunistyczna ze mnie bestia, która umie wyczuć trend, to wziąłem się od n...
Jako że oportunistyczna ze mnie bestia, która umie wyczuć trend, to wziąłem się od n...
Jako że oportunistyczna ze mnie bestia, która umie wyczuć trend, to wziąłem się od n...
Jako że oportunistyczna ze mnie bestia, która umie wyczuć trend, to wziąłem się od n...
@grski:Ładny kod tj. prawie same funkcje. Osobiście nie lubię pisać klas i większość mojego kodu w Pythonie organizuję w podobny sposób. Część programistów prezentację "Stop writing classes" wyśmiało, ale dla mnie ma ona sporo sensu i coraz bardziej skłaniam się w stronę języków funkcyjnych (na razie zabawy z Coconut i Hy).