Skip to content

Instantly share code, notes, and snippets.

View marek-saji's full-sized avatar
:shipit:

Marek ‘saji’ Augustynowicz marek-saji

:shipit:
View GitHub Profile
@marek-saji
marek-saji / 01-output
Created May 18, 2015 15:26
eval "tail | grep" | cat
$ ~/foo.sh 2>/dev/null
I want this:
eval "tail -n100 -f /tmp/tmp.85E0vH3e5d | grep 'GET./foo'" | cat
(real use case is running `tail -f | grep` in this: https://github.com/marek-saji/task-runner.sh/blob/b876596dab86c30c57ee341ca4511e079a2ae4ff/src/task-runner.sh#L89-L91)
... but that doesn't work
Removing `| cat` makes it work:
eval "tail -n100 -f /tmp/tmp.85E0vH3e5d" | grep 'GET./foo'
GET /foo
0x0041ce10: int $3
Modules:
Module Address Debug info Name (146 modules)
PE 400000- 4b1000 Export maelstrom
PE 1c20000- 1c45000 Deferred chrome_elf
PE 1c50000- 405b000 Export chrome
ELF 7b800000-7ba62000 Deferred kernel32<elf>
\-PE 7b810000-7ba62000 \ kernel32
ELF 7bc00000-7bce7000 Dwarf ntdll<elf>
\-PE 7bc10000-7bce7000 \ ntdll
@marek-saji
marek-saji / generate-stuff.sh
Last active August 29, 2015 14:18
Generate listing of stuffs
#!/bin/sh
# TODO Create single commit
# TODO Run find in paralell, display single progress bar
# exit if any command fails
set -e
# kill immediate children, when script ends
trap 'ps -opid= --sort=start_time --ppid=$$ | head -n-2 | xargs kill' INT TERM QUIT EXIT
@marek-saji
marek-saji / waffleio-no-cards.user.js
Last active August 29, 2015 14:18
Userscript for waffle.io that opens GitHub issues instead of waffle cards. Tested only of TamperMonkey <https://tampermonkey.net/>.
// ==UserScript==
// @name waffle.io -- open issues instead of cards
// @namespace https://twitter.com/saji_
// @version 1.0
// @description as name promises
// @match https://waffle.io/*
// @copyright 2015+, Marek ‘saji’ Augustynowicz
// ==/UserScript==
$(document).on('click', '.card-number', function (event) {
@marek-saji
marek-saji / command-stats
Last active January 26, 2018 08:04
awk '{ if ($1 ~ /=/) { print $2 } else { print $1 } }' ~/.bash_history | sort | uniq -c | sort -nr | head -n25
4239 git
447 vim
343 ls
219 cd
186 npm
169 sudo
114 doctrine-module
97 less
93 gulp
81 php
@marek-saji
marek-saji / git-usage-stats
Last active August 29, 2015 14:17
awk '($1 == "git") { print $2 }' ~/.bash_history | sort | uniq -c | sort -nr
626 status
544 commit
526 add
411 lg
253 diff
249 grep
224 checkout
207 rebase
164 push
163 show
@marek-saji
marek-saji / Progressive-Enhancement.md
Last active August 29, 2015 14:13
Progressive Enhancement

Progressive Enhancement

Wiele osób myśli, że chodzi tu tylko o to, żeby strona działania temu 0.5% ludzi, którzy wyłączyli sobie JS. Tymczasem chodzi o odwrócenie myślenia — ustanowienie najniżej poprzeczki, jak to możliwe dla „core experience” i traktowanie wszystkiego innego jako dodateku. Tak więc:

  • <picture>? Bonus. Większość przeglarek nie zrozumie co to.

  • <img srcset>? Bonus. Podstawą jest atrybut src z obrazkiem w niskiej rozdzielczości

@marek-saji
marek-saji / clean-up-after-cmd-exit.sh
Last active August 29, 2015 14:10
Clean up after script ends (e.g. on ssh timeout)
#!/bin/bash
# Clean up after script ends (e.g. on ssh timeout)
TIMEOUT=3
HEARTBEAT=$(( TIMEOUT - 2 ))
TIMESTAMP_FILE=$( mktemp )
date +%s > ${TIMESTAMP_FILE}
nohup bash -c "
@marek-saji
marek-saji / gist:ba8b26f0c3d806f2e2f0
Last active August 29, 2015 14:07
A bit cleaner HipChat layout
@-moz-document regexp("https://.*.hipchat.com/chat") {
/* collapsable sidebar on narrow screens */
@media all and (max-width: 50em)
{
/*.top_bar_private ~ */ #sidebar {
position: relative;
left: calc(199px - 3em);
transition: left 0.2s;
}
@marek-saji
marek-saji / chrome-wrapper.patch
Created July 25, 2014 13:24
Script (may be used in cron) for downloading freach chromium build
--- chrome-linux/chrome-wrapper 2013-10-08 10:17:28.000000000 +0200
+++ chrome-linux/chrome-wrapper 2013-10-08 20:32:38.927865329 +0200
@@ -27,7 +27,7 @@
for dir in $search; do
unset IFS
[ "$dir" -a -d "$dir/applications" ] || continue
- [ -r "$dir/applications/$DESKTOP.desktop" ] && return
+ [ -n "$( find -L "$dir/applications/" -name "$DESKTOP.desktop" )" ] && return
done
# Didn't find it in the search path.