Skip to content

Instantly share code, notes, and snippets.

View dtgay's full-sized avatar

David Gay dtgay

View GitHub Profile
@lmacken
lmacken / sshtail.py
Last active October 3, 2015 07:08
A script to tail a file across many systems at once
# sshtail.py
# A script to tail a file across many systems at once
# Author: Luke Macken <lmacken@redhat.com>
# License: GPLv3+
import getpass
import subprocess
servers = ['app1', 'app2', 'app3', 'app4', 'app5', 'app6', 'app7']
logfile = '/var/log/httpd/access_log'
#!/usr/bin/env python
""" What's the fastest way to initialize a 2-D array? """
import time
N = 1000
WIDTH, HEIGHT = N, N
@rossdylan
rossdylan / insanity.py
Created June 25, 2012 17:23
Pure insanity in one line
(lambda args: map(lambda repo: __import__("os").system('git clone {0} {1}/{2}'.format(repo.git_url,args.backupdir,repo.name)),__import__("pygithub3").Github().repos.list(args.username).all()))((lambda : (lambda : [globals().update(argparser=__import__("argparse").ArgumentParser(description="Backup allyour github repos")),map(lambda arg: globals()["argparser"].add_argument(*arg["args"],**arg["kwargs"]),[{"args": ("username",),"kwargs": {"help": "A Github username"}},{"args": ("backupdir",),"kwargs": {"help": "The folder where you want your backups to do"}}]),globals()["argparser"].parse_args()])()[-1])())
@ralphbean
ralphbean / coder-shell.py
Created July 4, 2012 19:52
Having fun with coderwall
""" Run like: $ python coder-shell.py
First you need to: $ pip install coderwall requests fabulous
"""
from coderwall import CoderWall
import fabulous.image
import fabulous.text
import os
import requests
@ryansb
ryansb / doordecs.py
Created March 10, 2013 16:34
Just put an image at ./dec.jpg (or any other image you like) and input your names and you're all set to print as many door decs as you need. Work saved.
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
font = ImageFont.truetype("/usr/share/fonts/dejavu/DejaVuSans.ttf", 75)
namelist = [
# names go here
]
class directory(object):
""" pushd/popd context manager.
Use like:
>>> with directory("/tmp/"):
... pass # do some stuff
"""
def __init__(self, newPath):
@decause
decause / awardbadge.py
Last active December 15, 2015 04:39
Example code for awarding a badge via the tahrir-api
from tahrir_api.dbapi import TahrirDatabase
db = TahrirDatabase('backend://badges:badgesareawesome@localhost/badges')
badge_id = 'fossbox'
person_email = 'person@email.com'
person_id = hash(person_email)
issued_on = None
anonymous
anonymous / night-before-opsmas.txt
Created December 24, 2013 07:19
Twas the night before Opsmas..
'Twas the night before Christmas, when all through the racks
Not a server was alerting, not even Compaqs.
The backups were written to tapes with care
In hopes that later the data would be there.
The machines were nestled all snug in their sleds
Whilst visions of vengeance danced in their heads;
And oncall in his three-wolf and I in my rack.
Had just settled down for some syn and some ack.
@joepie91
joepie91 / vpn.md
Last active May 20, 2024 03:37
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@tabrindle
tabrindle / webp-convert-directory.sh
Last active May 15, 2024 20:57
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
#!/bin/bash
PARAMS=('-m 6 -q 70 -mt -af -progress')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)