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 click | |
@click.group() | |
@click.option('--foo', help='This is great.') | |
def cli(foo): | |
pass |
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
#cloud-config | |
apt_update: true | |
apt_upgrade: true | |
packages: | |
- augeas-tools | |
- screen | |
- curl | |
- wget | |
- build-essential | |
- git-core |
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 gnuplot | |
# sqlite3 | |
# select cast(temp as integer), round(avg(1000*usage), 2) from power group by 1; | |
set terminal png | |
set output "data.png" | |
set datafile separator "," | |
set title "Power consumption as a function of temperature" |
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 <pcap.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/time.h> | |
#define IP_SRC_OFFSET 34-8 | |
#define IP_DST_OFFSET 38-8 | |
void dump(char *name); |
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 sys | |
from os.path import basename | |
from dns import resolver, reversename | |
import socket | |
def get_single_reverse(ip): | |
rname = reversename.from_address(ip) | |
try: | |
responses = resolver.query(rname, "PTR") |
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.1 | |
import urllib.request | |
opener = urllib.request.FancyURLopener() | |
f = opener.open('https://localhost/url') | |
print(f.read()) |
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 | |
from tempfile import NamedTemporaryFile | |
from subprocess import call | |
import plistlib | |
with NamedTemporaryFile() as f: | |
call(['system_profiler', '-xml', 'SPPowerDataType'], stdout=f) | |
f.seek(0) | |
p = plistlib.readPlist(f) |
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 | |
# -*- coding: utf-8 -*- | |
# https://gist.github.com/1218504 | |
""" | |
generate_test_data.py | |
Copyright (c) 2010-2011 Kapsi Internet-käyttäjät ry. All rights reserved. | |
""" | |
import sys |
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 socket | |
import sys | |
PREFIX = "PREFIX:" | |
HOST = '127.0.0.1' | |
PORT = 5555 | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
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 | |
# encoding: utf-8 | |
import smtplib | |
from email.message import Message | |
from email.header import Header | |
from email.utils import formataddr | |
SMTP_SERVER = 'mail.suomi.net' | |
FROM_NAME = 'Example Sender' |
OlderNewer