Calculating average of list of numbers
awk '{sum+=$1} END {print "avg:", sum/NR}' RS="\n" numbers.txt

❣ Chile in a Photography ❣
One Nice Bug Per Day
untitled
h
🩵 avery cochrane 🩵
"I'm Dorothy Gale from Kansas"

PR's Tumblrdome

@theartofmadeline

izzy's playlists!
Aqua Utopia|海の底で記憶を紡ぐ
Mike Driver
No title available
RMH
Fai_Ryy
will byers stan first human second
taylor price

oozey mess
tumblr dot com

★
Claire Keane

seen from Malaysia

seen from Germany

seen from Brazil
seen from Brazil

seen from Germany
seen from Brazil
seen from United States
seen from United States
seen from United States
seen from United States
seen from United States
seen from United States
seen from United States
seen from Germany

seen from United States

seen from T1
seen from United States
seen from Australia

seen from United States

seen from Türkiye
@terminalas
Calculating average of list of numbers
awk '{sum+=$1} END {print "avg:", sum/NR}' RS="\n" numbers.txt
Piping into CLI #PHP
grep something | php -r "print_r(stream_get_contents(STDIN));"
How fast you can start working on new machine?
This week I’ve got new laptop. I was so excited so I wanted to start working with it as soon as possible. Didn’t want to waste my work, nor sleep hours. And... in 36 minutes I managed to setup all needed environment for my work. Including nginx, php-fpm, mysql, rabbitmq, java-jdk and my beloved iterm2 and sublime text with all my settings.
36 minutes! Pretty nice. But with some minor improvements I think I can do better. Maybe 15mins?
Protip: monitor your background scripts. Execution time, memory usage. Create alerts.
Protip: if using cronjob, check if process not running, before starting another one.
$ gem install t
A command-line power tool for Twitter. https://github.com/sferik/t
New Year Resolution #2: Infrastructure as Code.
Everywhere. From home to business - everything should be managed under VCS.
Home media center: The Beginning
First step - Kodi (ex. XBMC) on Android TV, media source - folder shared over HTTP.
Upcoming - NAS.
New Year resolution: write less code, solve more problems.
That feeling when you find this kind of comment in code...
// No idea why, but it must be that way.
And the author is... ME! I just want to punch myself....
Delivering emails within long-lasting jobs
I found a little issue with email delivery using SMTP within long-lasting jobs. The problem - SMTP connection is created for first email delivery, and kept open only for certain time. When the job tries to send another email after some time - it fails. Solution - reconnect to smtp server before sending email.
Not sure yet how efficient it is, but it works now.
Here is my trick:
<?php
class .... {
public function __construct(Swift_Mailer $mailer) { $this->mailer = $mailer; }
public function deliver(Swift_Message $message) { // get configured mailer transport $transport = $this->mailer->getTransport(); // connect to smtp server $transport->start(); // send message $result = $this->mailer->send($message); // close connection $transport->stop();
return $result; }
}
$ tail -f *.log is like crystal ball for admin
Removing code...
That feeling, when there is A LOT OF CODE, and only 1/3 of it is necessary for a fully working functionallity.
And you refactor.. And more lines of code you delete, more you feel unsure about what you are doing...
There is a difference between git merge -Xours and git rebase -Xours
It’s a reminder for myself. Somehow from time to time I mix those and the result - lots of crap pushed to repository.
Don’t be like me, always remember the difference.
Very simple and clear explanation: https://demisx.github.io/git/rebase/2015/07/02/git-rebase-keep-my-branch-changes.html
Bash skriptai - maži, bet galingi. Hell yeah!
Bug report
How to fill a bug?
- Take a screenshot - Print it - Mark the problems with a pencil - Scan it - Create PDF - Send it by email
True story.
Deploy big release like a champ.