Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import sys
import evdev
import time
import subprocess
# gatttool -i hci0 -b E0:E5:CF:AD:71:A0 --char-write-req -a 0x0043 -n cc2333 #on
# gatttool -i hci0 -b E0:E5:CF:AD:71:A0 --char-write-req -a 0x0043 -n cc2433 #on
virsh vol-create-as default vic-bigger.img 120G
sudo virt-resize --expand /dev/sda1 /var/lib/libvirt/images/vic.img /var/lib/libvirt/images/vic-bigger.img
virsh edit vic
<hostdev mode='subsystem' type='usb' managed='no'>
<source>
<vendor id='0x2040'/>
<product id='0x7070'/>
<address bus='1' device='47' />
</source>
</hostdev>
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("index.html"))
soup.find_all("span", class_="time")[270].a.get('href') # Get link to main vine page (which then needs parsing)
soup.find_all("span", class_="time")[270].a.text # Time
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
from os import environ
def test(HandlerClass=SimpleHTTPRequestHandler,
ServerClass=BaseHTTPServer.HTTPServer):
protocol = "HTTP/1.0"
host = environ.get('OPENSHIFT_PYTHON_IP')
port = int(environ.get('OPENSHIFT_PYTHON_PORT'))
server_address = (host, port)
git remote add github git@github.com:bmsleight/openshift-splendidsnap.git
git push github master:master
openshift
Make django project
python3 -m venv myvenv
. myvenv/bin/activate
pip install django==1.8
git clone ssh://56982d900c1e664c8f0000e0@splendidsnap-bmsleight.rhcloud.com/~/git/splendidsnap.git/
#!/usr/bin/env python
"""
Use byzanz to create a GIF screencast of a specific window.
Required tools:
sudo apt-get install byzanz x11-utils xdotool
A tip: use an extra-long duration (-d 100), record your shot, and use
gimp to shorten the duration of the last frame. You need to rename the layer
from "Frame 123 (100000 ms) (combine)" to "Frame 123 (1000 ms) (combine)".
@bmsleight
bmsleight / #rc.local
Last active August 29, 2015 14:10
New Cloud Thingie
#/etc/rc.local
/usr/local/sbin/cloud
@bmsleight
bmsleight / gist:7cd3b0511d78a071df03
Last active August 29, 2015 14:10
Cloudie Thingie
/usr/local/sbin/cloud
pkg_add x11vnc
pkg_add xfce
x11vnc -storepasswd /home/bms/.vnc/passwd
x11vnc --ssl SAVE -http -rfbauth /home/bms/.vnc/passwd -forever -loop100 -display :0
(Sets certs)
kudos to http://www.tumfatig.net/20120614/the-remote-openbsd-5-1-desktop/