Skip to content

Instantly share code, notes, and snippets.

@csik
csik / gist:651e35ecfbbcddcbd9f9
Created Feb 24, 2016
A quick way to randomly change your mac address (os x) -- great for airports.
View gist:651e35ecfbbcddcbd9f9
sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
@csik
csik / gdrive_dl.py
Last active Apr 1, 2019
Download Large Files from Google Drive
View gdrive_dl.py
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
"""API calls to download a very large google drive file. The drive API only allows downloading to ram
(unlike, say, the Requests library's streaming option) so the files has to be partially downloaded
and chunked. Authentication requires a google api key, and a local download of client_secrets.json
Thanks to Radek for the key functions: http://stackoverflow.com/questions/27617258/memoryerror-how-to-download-large-file-via-google-drive-sdk-using-python
"""
@csik
csik / gist:090b404408cb6b8d1a62
Last active May 16, 2018
Freeswitch_Install
View gist:090b404408cb6b8d1a62
#!/bin/bash
# FreeSWITCH Installation script for CentOS 5.5/5.6
# and Debian based distros (Debian 5.0 , Ubuntu 10.04 and above)
# Copyright (c) 2011 Plivo Team. See LICENSE for details.
FS_CONF_PATH=https://github.com/plivo/plivoframework/raw/master/freeswitch
FS_GIT_REPO=https://stash.freeswitch.org/scm/fs/freeswitch.git
FS_INSTALLED_PATH=/usr/local/freeswitch
@csik
csik / textbelt.py
Created Nov 14, 2014
IP addresses are limited to 75 texts per day. Phone numbers are limited to 3 texts every 3 minutes. To report abuse or request increased limits, please contact ianw_textbelt at ianww.com.
View textbelt.py
"""IP addresses are limited to 75 texts per day.
Phone numbers are limited to 3 texts every 3 minutes.
To report abuse or request increased limits, please contact
ianw_textbelt at ianww.com."""
import httplib, urllib
def send_text(numstring, message):
params = urllib.urlencode({'number': numstring, 'message': message})
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
View trainwreck.py
from jnius import autoclass
from time import sleep
MediaPlayer = autoclass('android.media.MediaPlayer')
ones = MediaPlayer()
ones.setDataSource("/sdcard/Music/05 Steve Miller Band Fly Like An Eagle Remix.mp3")
ones.prepare()
twos = MediaPlayer()
@csik
csik / gist:4988995
Created Feb 19, 2013
Ultrabasic code for reading a geiger counter
View gist:4988995
import serial
#to use the serial library, you need to have pyserial installed, otherwise it won't find the serial library
ser = serial.Serial('/dev/tty.usbserial-A9014NPA',9600)
#Above we create a new serial object
the_time = 0
counter = 0
while(1):
You can’t perform that action at this time.