This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "${1:-}" ]; then | |
echo "usage: $0 [DOMAIN|renewall]" | |
exit 1 | |
fi | |
# ensure running as root | |
if [ "$(id -u)" != "0" ]; then | |
#exec sudo "$0" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use strict; | |
use Cwd; | |
use Digest::MD5 qw(md5); | |
use Dumpvalue; | |
use File::Compare qw(compare); | |
use File::Copy qw(cp); | |
use File::Find; | |
use File::Temp qw(tempfile); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="https://github.com/lyoshenka" class="github-corner"> | |
<svg width="80" height="80" viewBox="0 0 250 250" style="fill:#eee; color:#151513; position: absolute; top: 0; border: 0; right: 0;"> | |
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path> | |
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path> | |
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* HOW TO USE | |
$lockFile = Lock::getLock('lock-name'); | |
if (is_resource($lockFile)) { | |
// you have a lock here, do whatever you want | |
Lock::freeLock($lockFile); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Shell | |
* | |
* Execute shell commands properly. | |
* - forks a separate process to run the command | |
* - collects all output (including the exit code and stderr) and returns it neatly | |
* - optionally prints the output/error to stdout/stderr, so you can see it in (almost) real time | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!function(){"use strict";function e(){var e,t,a;e=JSON.parse(this.responseText),t=document.querySelectorAll("img"),a=Array.prototype.slice.call(t),a.forEach(function(t){var a=e.data[Math.floor(Math.random()*e.data.length)];t.src=a.images.fixed_height.url})}console.log("Thank you for twerking");var t;t=new window.XMLHttpRequest,t.addEventListener("load",e),t.open("GET","https://api.giphy.com/v1/gifs/search?q=twerking&api_key=dc6zaTOxFJmzC"),t.send()}(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Cronic v2 - cron job report wrapper | |
# Copyright 2007 Chuck Houpt. No rights reserved, whatsoever. | |
# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/ | |
set -eu | |
OUT=/tmp/cronic.out.$$ | |
ERR=/tmp/cronic.err.$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function() { | |
function loadScript(a, b) { | |
var c = document.createElement('script'); | |
c.type = 'text/javascript'; | |
c.src = a; | |
var d = document.getElementsByTagName('head')[0], | |
done = false; | |
c.onload = c.onreadystatechange = function() { | |
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { | |
done = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set prompt (including git repo info) | |
# https://gist.github.com/31631 | |
PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 50 ]; then CurDir=${DIR:0:22}...${DIR:${#DIR}-25}; else CurDir=$DIR; fi' | |
if [ -f ~/Dropbox/bash/completion/git ]; then | |
source ~/Dropbox/bash/completion/git | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
PS1='\[\033[0;33m\]$(date +%H%M) \[\033[1;37m\]\h:\[\033[1;36m\]$CurDir\[\033[00m\]$(__git_ps1)\$ ' | |
elif [ -n "$(which git)" ]; then | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" |