Skip to content

Instantly share code, notes, and snippets.

@jwoschitz
jwoschitz / cleanup.py
Created February 17, 2012 20:29
directory cleanup script
'''
/* @Cleanup\Delete("SomeRandomString-123") */
// @Cleanup\Delete("asd")
'''
import os, re, argparse
class Filter():
def matches(self):
raise NotImplementedError()
@jwoschitz
jwoschitz / gist:5686787
Last active December 17, 2015 23:08
Old brute force algo (C#)
/*
* Ugly, deprecated code, just archived as a gist
*
* If you're looking for an example implementation for a brute force algorithm,
* you may want to look at this repo: https://github.com/jwoschitz/Brutus/
*/
class Program
{
#region Private variables
@jwoschitz
jwoschitz / gist:7695923
Created November 28, 2013 17:57
xmas-market-scraper
'''
dependencies:
requests
http://www.python-requests.org/
pip install requests
beautifulsoup4
http://www.crummy.com/software/BeautifulSoup/
pip install beautifulsoup4
'''
@jwoschitz
jwoschitz / xmas.py
Created November 28, 2013 19:42
rasperry pi message emitter for xmas
import requests
url = 'http://192.168.178.134:8080'
chars = {
" ": [
'0',
'0',
'0',
'0'
@jwoschitz
jwoschitz / child_file.php
Created May 5, 2014 22:09
Workaround for get_parent_class in hhvm if spl_autoloader is used
<?php
spl_autoload_register(function ($class) {
// in hhvm, this will not get executed
include 'parent_file.php';
});
// this will return false in hhvm due to https://github.com/facebook/hhvm/issues/2097
var_dump(get_parent_class('C'));
@jwoschitz
jwoschitz / create_objectid.js
Created April 6, 2017 09:45
Create artificial mongodb ObjectId for a given timestamp
print(ObjectId(Math.floor(ISODate("2015-05-07T11:00:00.000Z")/1000).toString(16) + "0000000000000000"))
@jwoschitz
jwoschitz / ssh-multi.sh
Created May 18, 2017 12:28 — forked from dmytro/ssh-multi.sh
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
starttmux() {
if [ -z "$HOSTS" ]; then
@jwoschitz
jwoschitz / NConverter.java
Created June 12, 2017 23:50
N-Number & ICAO address converter
public class NConverter {
private final String base9; // The first digit (after the "N")
// is always one of these.
private final String base10; // The possible second and third digits
// are one of these.
// Note that "I" and "O" are never used as letters,
// to prevent confusion with "1" and "0"
@jwoschitz
jwoschitz / commandline.py
Created July 27, 2017 08:40 — forked from opie4624/commandline.py
Base Python Command Line template
#!/usr/bin/env python
#
# import modules used here -- sys is a very standard one
import sys, argparse, logging
# Gather our code in a main() function
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
@jwoschitz
jwoschitz / http-get-with-requests.py
Created August 14, 2017 08:21
HTTP GET with Python requests
#!/usr/bin/env python
import sys, argparse, logging, requests, json
def main(args, loglevel):
logging.basicConfig(format="%(levelname)s: %(message)s", level=loglevel)
repositories =[]