Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
import re
import json
from bs4 import BeautifulSoup as bs
from urllib2 import urlopen
__authors__ = ['haxwithaxe [email protected]']
__license__ = 'GPLv3'
@haxwithaxe
haxwithaxe / create-debian-mirrors-acl
Created October 31, 2015 14:49
Create a squid acl that includes all the mirrors listed on Debian's mirrors list.
#!/usr/bin/env python3
# requires: requests, lxml
import requests
import sys
from lxml import html
def filter_for_http_repo_links(a_elem):
@haxwithaxe
haxwithaxe / _oauth_with_jira.md
Last active March 13, 2016 15:10
Oauth with Jira: a tale of crappy documentation

The relavent documentation is (here)[https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples]. The example application info they provide is below. They did not use this in the example code for whatever reason. Consumer key: dpf43f3p2l4k3l03 Consumer name: OAuth Test Description: OAuth Test Example Public key: Consumer callback URL: http://<hostname where you're hosting this code>/auth

Included is a modified app.py. They had a test to demonstrate that you can't access an issue before oauth is setup and can after it is setup ... this doesn't work well if you have annonymous access enabled ... I removed the cute demo tests.

@haxwithaxe
haxwithaxe / hellosh.c
Created January 18, 2016 17:17
Hello world unix shell
/* hellosh
* based on http://stephen-brennan.com/2015/01/16/write-a-shell-in-c/ (first hit on google for "how to write a shell")
* compile: gcc -o hellosh hellosh.c
*/
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@haxwithaxe
haxwithaxe / stream_video_over_vpn.md
Last active March 13, 2016 15:07
stream remote webcam over vpn
  1. forward port to local machine

    ssh -L 8080:localhost:8080 <remote ssh host>
    
  2. run vlc on the remote machine

cvlc v4l2:///dev/video0 :v4l2-standard= :live-caching=300 :sout="#transcode{vcodec=x264,acodec=none}:http{mux=ts,dst=:8080/stream}"

@haxwithaxe
haxwithaxe / index.sh
Last active February 10, 2016 00:46
Create static html directory indexes
#!/bin/bash
# generate an html index of a directory
#
# Arguments:
# $1 (optional): Path to create the index.html relative to.
#
# Outputs:
# STDOUT: HTML index of files in $path
#
#!/usr/bin/env python3
import csv
import json
from lxml import etree
from pykml.factory import KML_ElementMaker as K
OPERATIONS = {
@haxwithaxe
haxwithaxe / hope-dump.sh
Last active July 28, 2016 18:23
download all the things
#!/bin/bash
URL_BASE="http://livestream.com/internetsociety" #"/hopeconf"
VIDEO_TYPE="progressive_url"
touch lamarr noether friedman
dump_track(){
wget -O - "http://livestream.com/internetsociety${1}/hopeconf" 2>/dev/null| sed 's/","/",\n"/g' | grep $VIDEO_TYPE | grep -v smil | sed 's/[",]\+$//;s/.*"//' | grep http
}
@haxwithaxe
haxwithaxe / outgress.py
Created September 28, 2016 04:30
An adapter from outgress to IFTTT Maker action. Use as a cgi and set the destination to it in outgress.
import cgi
import requests
__author__ = 'haxwithaxe <[email protected]>'
__license__ = 'GPLv3'
IFTTT_TRIGGER = '<your maker action name here>'
@haxwithaxe
haxwithaxe / dnsmasq
Last active June 16, 2021 06:01
OpenWRT init script that adds the ability to create a hosts file with the static dhcp hostnames.
#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2012 OpenWrt.org
START=60
USE_PROCD=1
PROG=/usr/sbin/dnsmasq
DNS_SERVERS=""
DOMAIN=""