Skip to content

Instantly share code, notes, and snippets.

@tito
tito / ble.py
Created February 5, 2014 19:39
Bluetooth Low Energy explorer, working on MacOSX 10.9 using latest Pyobjus.
from pyobjus import autoclass, protocol
from pyobjus.dylib_manager import load_framework, INCLUDE
(CBCentralManagerStateUnknown,
CBCentralManagerStateResetting,
CBCentralManagerStateUnsupported,
CBCentralManagerStateUnauthorized,
CBCentralManagerStatePoweredOff,
CBCentralManagerStatePoweredOn) = range(6)
@L422Y
L422Y / multisync.sh
Last active February 21, 2021 23:57
lftp script to mirror remote ftp site to local folder using multiple connections per file and parallel file downloads (for reference/cron jobs)
#!/bin/bash
do_multisync() {
remote_dir="private/files"
local_dir="/root/i_drive/files"
# remote host
host="ftp.myremotehost.com"
# username / password
user="larry"
@sdball
sdball / googlemaps_loading_lots_of_points.js
Created January 1, 2011 23:29
A sampling of code for loading/unloading thousands of points as the user pans around the map.
function requestMarkers() {
// no loading markers when zoomed way out
if (map.getZoom() < 11) { return };
// start dropping markers before the browser bogs down
if (markers.length > 50) {
dropSuperfluousMarkers();
}
$.ajax({
// [snip typical ajax data request]
success: populateMarkers,