Skip to content

Instantly share code, notes, and snippets.

@jmtd
jmtd / keybase.md
Created March 26, 2014 16:44
keybase.io proof for github.com/jmtd

Keybase proof

I hereby claim:

  • I am jmtd on github.
  • I am jmtd (https://keybase.io/jmtd) on keybase.
  • I have a public key whose fingerprint is E037 CB2A 1A00 61B9 4336 3C8B 0907 4096 06AA AAAA

To claim this, I am signing this object:

@jmtd
jmtd / gist:f2b0347c0a7cbfba77ac
Created February 18, 2015 16:35
PGP interestingness
def score(s):
i=1
p = s[0]
for c in s[1:]:
if int(c,base=16) == int(p,base=16)+1:
i += 1
p = c
return i
# or
$ rip cd rip
Using configured read offset 102
Checking device /dev/sr0
CDDB disc id: 8d118c19
MusicBrainz disc id jf3pYmBGrs9ZCvrtnTNeNRgLElc-
MusicBrainz lookup URL http://mm.musicbrainz.org/bare/cdlookup.html?toc=1+25+337085+150+11437+22390+33164+44664+54643+66344+78609+89584+99789+109275+119516+132569+143938+155212+166693+176800+192408+207455+221875+248292+265299+283674+298109+313129&tracks=25&id=jf3pYmBGrs9ZCvrtnTNeNRgLElc-
Disc duration: 01:14:52.466, 25 audio tracks
Matching releases:
cevm$ docker exec -ti testcontainer ls -lZ /etc/resolv.conf
-rw-r--r--. root root system_u:object_r:svirt_sandbox_file_t:s0:c947,c1012 /etc/resolv.conf
cevm$ docker stop testcontainer
testcontainer
cevm$ docker start testcontainer
testcontainer
cevm$ docker top testcontainer
UID PID PPID C STIME TTY TIME CMD
root 8702 907 1 16:07 ? 00:00:00 bash -c while true; do sleep 300; echo; done
pavonis$ cat test.sh
service="hi_there"
if [[ "$service" == *"_"* ]]; then
echo works 1
fi
if [ "$service" == *"_"* ]; then
echo works 2
fi
@jmtd
jmtd / bollocks.sh
Created October 16, 2015 10:00
blah
echo parent pid is $BASHPID
bollocks() {
pidfile=$(mktemp -t bollocks.XXXXXX)
ls -ld "$pidfile"
(
echo $BASHPID | tee "$pidfile"
sleep 30
rm "$pidfile"
) &
// can we fit in the skill level?
if ((end - cursor + 1) - maplen >= sizeof "skillX " - sizeof "")
{
char *p = "skill0 ";
while(*p)
{
*cursor++ = *p++;
}
cursor[-2] += startskill;
}
// can we fit in the skill level? (e.g. 'skill3')
if ((end - cursor) - maplen >= 6)
{
// M_snprintf writes a \0 that we don't need, hence 7 here
M_snprintf(cursor, 7, "skill%1d", startskill);
cursor += 6;
}
$ curl -kI -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30" https://cevm.local:8443/
HTTP/1.1 302 Found
Location: https://172.17.130.226:8443/console/
Date: Tue, 02 Aug 2016 17:39:34 GMT
Content-Length: 203
Content-Type: text/plain; charset=utf-8
2016-08-03 11:01:37,161 - cct - DEBUG - processing change [{'changes': [{'base.Chmod': [{'path': '/opt/amq', 'mode': 493}, {'path': '/opt/amq/bin/activemq', 'mode': 493}]}, {'base.Chown': [{'owner': 'jboss', 'path': '/opt/amq', 'group': 'jboss', 'recursive': True}]}], 'description': 'say hello', 'name': 'base'}]
2016-08-03 11:01:37,162 - cct - INFO - executing change base
2016-08-03 11:01:37,162 - cct - DEBUG - path
2016-08-03 11:01:37,162 - cct - DEBUG - mode
Traceback (most recent call last):
File "/usr/bin/cct", line 9, in <module>
load_entry_point('cct==0.0.1.dev0', 'console_scripts', 'cct')()
File "/usr/lib/python2.7/site-packages/cct/cli/main.py", line 117, in run
cli.run()
File "/usr/lib/python2.7/site-packages/cct/cli/main.py", line 105, in run