Setup foo,bar,baz boolean vars
zstyle ':example:foo' doit yes
zstyle ':example:bar' doit no
# leave baz unset| #!/bin/sh | |
| #Joel Bruner (https://github.com/brunerd) | |
| function screenIsLocked { [ "$(/usr/libexec/PlistBuddy -c "print :IOConsoleUsers:0:CGSSessionScreenIsLocked" /dev/stdin 2>/dev/null <<< "$(ioreg -n Root -d1 -a)")" = "true" ] && return 0 || return 1; } | |
| function screenIsUnlocked { [ "$(/usr/libexec/PlistBuddy -c "print :IOConsoleUsers:0:CGSSessionScreenIsLocked" /dev/stdin 2>/dev/null <<< "$(ioreg -n Root -d1 -a)")" != "true" ] && return 0 || return 1; } | |
| if screenIsLocked; then | |
| echo "Screen locked" | |
| fi |
| #!/bin/bash | |
| # ######################################################### | |
| # | |
| # WW WW AAA RRRRRR NN NN IIIII NN NN GGGG | |
| # WW WW AAAAA RR RR NNN NN III NNN NN GG GG | |
| # WW W WW AA AA RRRRRR NN N NN III NN N NN GG | |
| # WW WWW WW AAAAAAA RR RR NN NNN III NN NNN GG GG | |
| # WW WW AA AA RR RR NN NN IIIII NN NN GGGGGG | |
| # |
| // PhantomJS Cheatsheet | |
| $ brew update && brew install phantomjs // install PhantomJS with brew | |
| phantom.exit(); | |
| var page = require('webpage').create(); | |
| page.open('http://example.com', function() {}); | |
| page.evaluate(function() { return document.title; }); |
| # Dirty command line used to scan each gitlab repository and extract some stats | |
| # in this case : foreach commit > 2014-01-01 get the number of commmits, number of line added, deleted grouped by users | |
| rm /tmp/stats2014.csv; find /home/git/repositories -name .git -prune -o -name '*.git' -print | while read directory; do cd $directory; git log --after="2014-01-01" --format='%aN' |sort -u | while read name; do echo -en "Project\t$directory\t" >> /tmp/stats2014.csv; echo -en "Author\t$name\t" >> /tmp/stats2014.csv; git log --after="2014-01-01" --after="2014-01-01" --author="$name" --pretty=format:%ae | gawk -- '{ ++c; } END { printf "Number of commits\t%s\t",c; }' >> /tmp/stats2014.csv; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "Added lines\t%s\tRemoved lines\t%s\tTotal lines\t%s\n", add, subs, loc }' >> /tmp/stats2014.csv; done; done; | |
| #!/usr/bin/python | |
| import sys | |
| import argparse | |
| import re | |
| import urllib, urllib2 | |
| import time | |
| from collections import namedtuple | |
| # Basically the nginx configuration I use at konklone.com. | |
| # I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com | |
| # | |
| # To provide feedback, please tweet at @konklone or email [email protected]. | |
| # Comments on gists don't notify the author. | |
| # | |
| # Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites. | |
| # Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration. | |
| server { |