Skip to content

Instantly share code, notes, and snippets.

@tmcw
tmcw / disconnect.rb
Created July 22, 2011 04:06
bulk-export run data from Garmin Connect
#!/usr/bin/env ruby
## disconnect
# ./disconnect.rb -u yourusername
#
# This is a command-line utility for the bulk-downloading of run data from
# the connect.garmin.com web application, which has lackluster export
# capabilities.
#
@provegard
provegard / ssdp-test.py
Created December 5, 2011 21:52
Small SSDP server/client test in Python
#!/usr/bin/python
# Python program that can send out M-SEARCH messages using SSDP (in server
# mode), or listen for SSDP messages (in client mode).
import sys
from twisted.internet import reactor, task
from twisted.internet.protocol import DatagramProtocol
SSDP_ADDR = '239.255.255.250'
@lloeki
lloeki / battery.py
Last active January 10, 2023 16:04
Battery status script for Mac OS X
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from subprocess import Popen, PIPE
def ioreg_battery_info():
output = Popen(["ioreg", "-r", "-k", "LegacyBatteryInfo", "-w", "0"], stdout=PIPE).communicate()[0]
try: #python3
#!/bin/bash
redis_version=2.6.7
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/raw/4497007/866287a130a5a4ca12a132fd52e391cde39f4f3f/install-redis.sh
# chmod +x install-redis.sh
# ./install-redis.sh
@02strich
02strich / dlna_proxy.py
Created May 2, 2013 19:33
DLNA Proxy (including SSDP and Multicast)
import socket, thread, sys
import logging
BUFLEN = 1024
logger = logging.getLogger(__name__)
class DLNAProxy(object):
MEDIASERVER_IP = ""
@dankrause
dankrause / ssdp.py
Last active July 8, 2024 02:05
Tiny python SSDP discovery library with no external dependencies
# Copyright 2014 Dan Krause
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@chrisparnin
chrisparnin / gist:6032323
Last active December 19, 2015 23:08
Summarize JSON
var sum = function(o, tabLevel){
for(var prop in o){
if(o.hasOwnProperty(prop)){
var val = o[prop];
var header = "";
for( var t = 0; t < tabLevel; t++ )
{
header += '\t';
}
console.log(header + prop + ":");
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/
@wbroek
wbroek / genymotionwithplay.txt
Last active November 8, 2024 01:24
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
public static boolean setProxy(WebView webview, String host, int port, String applicationClassName="android.app.Application") {
// 3.2 (HC) or lower
if (Build.VERSION.SDK_INT <= 13) {
return setProxyUpToHC(webview, host, port);
}
// ICS: 4.0
else if (Build.VERSION.SDK_INT <= 15) {
return setProxyICS(webview, host, port);
}
// 4.1-4.3 (JB)