Skip to content

Instantly share code, notes, and snippets.

View andypiper's full-sized avatar
🛠️
tinkering

Andy Piper andypiper

🛠️
tinkering
View GitHub Profile
"""
BOSH Client
-----------
Quite simple BOSH client used by Django-XMPPAuth
For now, it only supports the DIGEST-MD5 authentication method.
"""
import httplib, sys, random
@op
op / bash-history-to-zsh-history.py
Created September 28, 2012 21:25
Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | bash-history-to-zsh-history >> ~/.zsh_history
import sys
def main():
@ttscoff
ttscoff / rtftomarkdown.rb
Created October 9, 2012 21:05
Convert RTF/DOC files to Markdown via Textutil
#!/usr/bin/ruby
=begin
Usage: rtftomarkdown.rb FILENAME.rtf
Uses textutil, available on Mac only (installed by default)
Outputs to STDOUT
Notes:
Links are replaced with Markdown references (duplicate links combined).
@ralight
ralight / printer.py
Created October 31, 2012 19:07
Print incoming MQTT messages with a maximum width of 32 characters.
#!/usr/bin/python
import mosquitto
import textwrap
def on_message(mosq, obj, msg):
for s in textwrap.wrap(msg.payload, width=32):
print(s)
mqttc = mosquitto.Mosquitto()
@andysc
andysc / perl_wrap.pl
Created October 31, 2012 19:12
wrap input to 32 columns, breaking on spaces
while (<>)
{
chomp;
$line = $_;
while (length($line) > 32)
{
$bit = substr($line,0,32);
$space = rindex($bit," ");
if ($space == -1)
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger ([email protected])
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@sharonbn
sharonbn / SslUtil.java
Last active August 21, 2022 05:48
SSL/TLS connection from Eclipse Paho Java client to mosquitto MQTT broker
import java.io.*;
import java.nio.file.*;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
import org.bouncycastle.jce.provider.*;
import org.bouncycastle.openssl.*;
public class SslUtil
@pengwynn
pengwynn / jq.sh
Created November 20, 2012 15:59
The Real j-query™
# http://stedolan.github.com/jq/
$ brew install jq
$ curl https://api.github.com/repos/rails/rails/commits | jq '.[].sha'
"abb38feac84da59f6686d9abcce61d2a9a64efa9"
"61425f2c6d14fe7151b09ffe5a5353924582e5b0"
"03ef833b804fe17ff834ac957a300d45bbb24fab"
"ce60672342f8da447d24d25f8c0f2049fc81c0c8"
"e492c446d520e8941624564b157b297cfd0aeaa9"
"bba8fc4294ca7f7d90c3e64e7fea059b17caef5c"
@mangrovemike
mangrovemike / mqtt_local_sub_cosm_pub.py
Created November 30, 2012 02:44
Mosquitto to COSM Bridge
#!/usr/bin/python
#
# MangroveMike
#
# Read the local MQTT channels and publish to my COSM channels
#
#
# Based upon great code from:
# Andy Piper
@mfr
mfr / netatmo_pws.php
Created December 23, 2012 10:56
Reading last data from netatmo device and sending it to wunderground.
#!/usr/bin/php
<?php
date_default_timezone_set('UTC');
/**
* oAuth settings from http://dev.netatmo.com/dev/listapps
*/
define('APP_ID', '');
define('APP_SECRET', '');
define('USERNAME', '');
define('PASSWORD', '');