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 contextlib | |
import fcntl | |
import sys | |
import time | |
class MutexException(Exception): | |
""" |
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 | |
def is_dyck_word(word): | |
i = 0 | |
for ch in word: | |
if ch == '[': | |
i += 1 | |
elif ch == ']': | |
i -= 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
function addEvent(obj, type, fn) { | |
// Mozilla/W3C listeners? | |
if (obj.addEventListener) { | |
obj.addEventListener(type, fn, false); | |
return true; | |
} | |
// IE-style listeners? | |
if (obj.attachEvent) { | |
return obj.attachEvent('on' + type, fn); |
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 contextlib | |
import fcntl | |
import time | |
class MutexException(Exception): | |
""" | |
Failed to lock a file. | |
""" |
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
get_nss () { | |
dig +aaonly @$(dig +short $(echo $1 | cut -f2- -d.) NS | head -n1) $1 NS | \ | |
grep -v '^;' | \ | |
awk '$4 == "NS" {print substr($5, 1, length($5) - 1)}' | sort -u | |
} | |
fqdn=google.com | |
dig +short @$(get_nss $fqdn | head -n1) $fqdn A |
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 | |
from __future__ import print_function | |
import argparse | |
import json | |
import sys | |
def process_args(): | |
parser = argparse.ArgumentParser() |
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 pygame | |
from pygame.locals import * | |
BOX_WIDTH = 100 | |
BOX_HEIGHT = 100 | |
BLACK = (0, 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
% python | |
Python 2.7.10 (default, Feb 7 2017, 00:08:15) | |
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> class A(object): | |
... pass | |
... | |
>>> a = A() | |
>>> a.__class__.__dict__ is a.__class__.__dict__ | |
False |
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
% sudo pkg upgrade | |
Updating FreeBSD repository catalogue... | |
FreeBSD repository is up to date. | |
All repositories are up to date. | |
Checking for upgrades (178 candidates): 100% | |
Processing candidates (178 candidates): 100% | |
Checking integrity... done (2 conflicting) | |
- postgresql95-client-9.5.7_1 conflicts with postgresql93-client-9.3.17_1 on /usr/local/bin/clusterdb | |
- postgresql95-client-9.5.7_1 conflicts with postgresql93-client-9.3.17_1 on /usr/local/bin/clusterdb | |
Checking integrity... done (0 conflicting) |
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
root 1677 0.0 0.0 108188 1412 ? S 02:33 0:00 /bin/bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/sbin/rabbitmq-server | |
root 1679 0.0 0.0 108188 1480 ? S 02:33 0:00 /bin/sh /usr/sbin/rabbitmq-server | |
root 1699 0.0 0.0 145024 1608 ? S 02:33 0:00 su rabbitmq -s /bin/sh -c /usr/lib/rabbitmq/bin/rabbitmq-server | |
rabbitmq 1704 0.0 1.4 581156 30128 ? Ssl 02:33 0:11 /usr/lib64/erlang/erts-5.8.5/bin/beam -W w -K true -A30 -P 1048576 -- |