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
import java.util.concurrent.atomic.AtomicReference | |
import collection.immutable.HashMap | |
/* | |
* A module which implements a primality cache for integers, with a max-age parameter which controls | |
* when a primality result will be considered 'expired' and recalculated from scratch. | |
*/ | |
trait PrimeCacheModule { | |
/** The current time in milliseconds. Timestamp for cache entries and 'now' */ | |
def now = System.currentTimeMillis |
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
# This should print 'second:third' | |
echo first:second:third | awk -F: '{ print substr($0, index($0, FS) + 1) }' | |
# Same here, but shorter code. | |
echo first:second:third | sed -e 's/^[^:]*://' | |
# Slightly more verbose awk version for 'second:third' output |
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
(defun keramida/erc-bitlbee-auto-identify () | |
"Auto-identify for Bitlbee channels using authinfo or netrc. | |
The entries that we look for in netrc or authinfo files have | |
their 'port' set to 'bitlbee', their 'login' or 'user' set to the | |
current nickname and 'server' set to the current IRC server's | |
name. A sample value that works for authenticating as user | |
'keramida' on server 'localhost' is: | |
machine localhost login \"keramida\" password \"****\" port bitlbee" |
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/sh | |
progname=`basename $0` | |
err() | |
{ | |
code="$1" | |
if test -z "$code" ; then | |
code=1 | |
fi |
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
0918 22:44 gkeramidas@gkeramidas-mbp:~$ ./to-ringtone.sh 00:00 00:30 ~/Music/iTunes/iTunes\ Media/Music/Black\ Sabbath/Heaven\ and\ Hell/01\ Neon\ Knights.mp3 neon.m4r | |
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers | |
built with Apple LLVM version 7.3.0 (clang-703.0.31) | |
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libopenh264 --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfdk-aac --enable-libx265 --disable-lzma --enable-nonfree --enable-vda | |
libavutil 55. 28.100 / 55. 28.100 | |
libavcodec 57. 48.101 / 57. 48.101 | |
libavformat 57. 41.100 / 57. 41.100 | |
libavdevice 57. 0.101 / 57. 0.101 | |
libavfilter 6. 47.100 / 6. 47.100 | |
libavresample 3. 0. 0 / 3. 0. 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
#!/bin/sh | |
progname=$(basename $0) | |
now() { | |
date '+%m%d %H:%M:%S' | |
} | |
err() { | |
errcode=$1 |
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
0523 17:42 gkeramidas@gkeramidas-mbp:~$ python cellular.py --sleep 100 --width 210 --rule 110 2>&1 | head -30 | |
('cellular: rule=110 width=210 delay=0.1',) | |
## # ### ## ###### # ## #### # ### ## ###### # #### # # ## #### # ### #### ### # ### # # # # ## # ## # #### # ## # ## # # ### ## ## # # ## # ## # # # ### | |
#### # ## ### # #### #### ## ## # ###### ## ### #### ##### # #### # ### ### ##### ## ###### ## ##### ###### #### ######## ## ## # ## ######## ####### ##### #### # ## | |
## ###### #### # ### ## ######### ## #### ## # ### #### # ## ### ## # ### ##### # ## #### ## # ## # ### ##### ######## # ## # ## # ## # ## ##### | |
### # ### ## ## # ## #### ## ### # ####### # ## # #### ### # ######## ## # #### ### # ## ##### ##### # ## # ### ## ## ### ## ### ## ##### ### # ## | |
# ## ## # ## ### ###### |
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/env python3 | |
import argparse | |
import sys | |
def pluralize(count): | |
return "bugs" if count > 1 else "bug" | |
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
1127 19:45 gkeramidas@gkeramidas-mbp:/opt/brew (master)$ rm -fr .[^.]* * | |
1127 19:45 gkeramidas@gkeramidas-mbp:~$ git clone https://github.com/Homebrew/brew /opt/brew | |
Cloning into '/opt/brew'... | |
remote: Enumerating objects: 14, done. | |
remote: Counting objects: 100% (14/14), done. | |
remote: Compressing objects: 100% (11/11), done. | |
remote: Total 161723 (delta 6), reused 7 (delta 3), pack-reused 161709 | |
Receiving objects: 100% (161723/161723), 41.42 MiB | 27.67 MiB/s, done. | |
Resolving deltas: 100% (119886/119886), done. |
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/env python | |
import datetime | |
import sys | |
def timestamp(): | |
now = datetime.datetime.now() | |
return (now.strftime('%Y-%m-%d %H:%M:%S.%m') + | |
".%06d" % now.microsecond) |