Skip to content

Instantly share code, notes, and snippets.

View andypiper's full-sized avatar
🛠️
tinkering

Andy Piper andypiper

🛠️
tinkering
View GitHub Profile
@lgladdy
lgladdy / twitter-application-only-auth.php
Created March 12, 2013 09:46
A working example of Twitter's new application-only auth, written in PHP.
<?php
//This is all you need to configure.
$app_key = '';
$app_token = '';
//These are our constants.
$api_base = 'https://api.twitter.com/';
$bearer_token_creds = base64_encode($app_key.':'.$app_token);
@ralight
ralight / multi.py
Last active December 15, 2015 02:39
Create 1000 mqtt clients (in 1000 threads) to test broker connections.
#!/usr/bin/python
import mosquitto
import time
def on_connect(mosq, obj, rc):
print("Connected: "+mosq._client_id)
def on_disconnect(mosq, obj, rc):
print("Disconnected: "+mosq._client_id + " ("+str(rc)+")")
@sulmanen
sulmanen / getTwitterBearer.js
Created March 26, 2013 14:27
Get twitter API 1.1 bearer token
var request = require('request');
var consumer_key = 'YOUR_CONSUMER_KEY';
var consumer_secret = 'YOUR_CONSUMER_SECRET';
var enc_secret = new Buffer(consumer_key + ':' + consumer_secret).toString('base64');
var oauthOptions = {
url: 'https://api.twitter.com/oauth2/token',
headers: {'Authorization': 'Basic ' + enc_secret, 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'},
body: 'grant_type=client_credentials'
};
@mschulz
mschulz / gist:5251466
Created March 27, 2013 03:50
mqtt_openbeacon_reader.py reads data from gist:5250657, adds the beacon reader header, then publishes this information as a hex string to an MQTT topic. CHECK: Just need to check that bytes are in network order for multi-byte variables!!
#!/usr/bin/env python
'''
mqtt_openbeacon_reader
This program reads the packet Openbeacon tag data collected via an Arduino connected to a Nordic nRF24L01+.
The data is then published via MQTT to our message server, as both a raw string and a JSON string.
Other software agents can subscribe to this data and do with it what they want, and maybe even
republish their results on other topics.
@jshaw
jshaw / byobuCommands
Last active November 23, 2025 15:33
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window
@njh
njh / mqtt-livetext-radio3.rb
Created March 27, 2013 18:14
Subscribe to BBC Radio 3 LiveText over MQTT
#!/usr/bin/env ruby
#
# Subscribe to BBC Radio 3 LiveText over MQTT
#
require 'rubygems'
require 'mqtt'
MQTT::Client.connect('test.mosquitto.org') do |c|
# If you pass a block to the get method, then it will loop
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active November 7, 2025 10:08
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@gnarf
gnarf / ..git-pr.md
Last active June 20, 2025 11:04
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@claws
claws / bomau_publisher.py
Last active April 22, 2016 18:13
Publish Australian weather observations to MQTT
#!/usr/bin/env python
'''
Chris Laws 2013
Publish Australian weather observations over MQTT.
This script periodically retrieves weather observations from the
Australia Bureau of Meteorology. The source data comes from a file