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 | |
sudo apt-get install -y autoconf automake autotools-dev g++ pkg-config python-dev python3-dev libtool make | |
[ ! -f ./flamegraph.pl ] && { | |
curl -O https://raw.githubusercontent.com/brendangregg/FlameGraph/master/flamegraph.pl | |
} | |
[ ! -f /usr/local/bin/pyflame -o ! -d pyflame ] && { | |
git clone https://github.com/uber/pyflame.git | |
cd pyflame |
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
#include <sys/cdefs.h> | |
#include <sys/types.h> | |
#include <sys/ioctl.h> | |
#ifdef __FreeBSD__ | |
#include <sys/endian.h> | |
#endif | |
#include <net/if.h> | |
#include <net/pfvar.h> |
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 ConfigParser | |
import json | |
import os | |
""" | |
Dirty script to get Mozilla Firefox tabs URLs on stdout | |
source: https://raymii.org/s/snippets/Get_the_current_or_all_Firefox_tab_urls_in_Bash.html |
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 termios | |
import fcntl | |
import os | |
import struct | |
with open(os.ctermid(), 'r') as fd: | |
packed = fcntl.ioctl(fd, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)) | |
rows, cols, h_pixels, v_pixels = struct.unpack('HHHH', packed) | |
print rows, cols, h_pixels, v_pixels |
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 inspect | |
import logging | |
logger = logging.getLogger('application') | |
def logit(order, *largs, **kwargs): | |
return True | |
__line__ = int(inspect.stack()[1][2]) | |
__function__ = inspect.stack()[1][3] | |
with_color=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
#include <stdio.h> | |
#include <sys/utsname.h> | |
inline static void | |
u() { | |
struct utsname uts; | |
uname(&uts); | |
printf("%s %s %s %s %s", uts.sysname, uts.nodename, uts.release, uts.version, uts.machine); |
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 time | |
import socket | |
_PATH_UNIX_X = "/tmp/.X11-unix/X%d" | |
DISPLAY_PORT = 0 | |
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | |
s.connect(_PATH_UNIX_X % DISPLAY_PORT) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <arpa/inet.h> | |
#include <ifaddrs.h> | |
#include <net/if.h> | |
#include <netinet/in.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
int |
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 socket | |
socket.create_connection(('127.0.0.1', 22)) | |
<socket._socketobject object at 0x9022bc4> | |
s=socket.create_connection(('127.0.0.1', 22)) | |
import gc | |
[ i for i in gc.get_objects() if type(i) == type(s) ] | |
[<socket._socketobject object at 0x9022bc4>, <socket._socketobject object at 0x92a4aac>] | |
t = [ i for i in gc.get_objects() if type(i) == type(s) ][0] | |
t | |
<socket._socketobject object at 0x9022bc4> |
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
{ | |
"@base": { | |
"files": [ | |
{ | |
"make.conf": { | |
"filename": "make.conf", | |
"dirpath": "/etc/", | |
"@destination": "/etc/make.conf", | |
"@content": { | |
"svn_update": "yes", |