Skip to content

Instantly share code, notes, and snippets.

@mcardillo55
mcardillo55 / razer_wave_speed.py
Created May 11, 2017 09:30
Control speed of the Razer 'wave' effect by sending custom values to the razerkbd driver and varying the sleep() time
# Author: Mike Cardillo, 2017
# Email: [email protected]
# Desc: Control speed of the Razer 'wave' effect by sending custom values to
# the razerkbd driver and varying the sleep() time.
import pyshark
import time
import os, sys
RAZERKBD_SYSFS_PATH = '/sys/bus/hid/drivers/razerkbd/0003:1532:0221.0013/'
#!/usr/bin/env python
from BeautifulSoup import BeautifulSoup
import json
html_doc = open("/Users/mcardill/Desktop/Mike Cardillo.html")
soup = BeautifulSoup(html_doc)
allFriends = soup.findAll("div", { "class": "fsl fwb fcb" })
@mcardillo55
mcardillo55 / bitcoin-addresses.py
Last active August 29, 2015 13:56
Demonstration of rarity in multiple bitcoin address generations
#!/usr/bin/python
''' bitcoin-addresses.py - Demonstration of rarity in multiple bitcoin address generations '''
import random
import sqlite3
class AddressStore:
_get_sql = 'SELECT val FROM addresses WHERE key = ?'
_max_sql = 'SELECT MAX(rowid) FROM addresses'
_set_sql = 'INSERT INTO addresses (key, val) VALUES (?, ?)'
@mcardillo55
mcardillo55 / uptime.php
Created July 30, 2013 05:57
Convert Linux uptime value to a more verbose/pretty form
<?php
$exec = shell_exec('uptime');
$uptime = explode(' up ', $exec);
$uptime = explode(',', $uptime[1]);
if (strpos($uptime[0], 'day')) {
$time = explode(':', $uptime[1]);
echo('Current system uptime is ' . $uptime[0]. ', ' . $time[0] . ' hours, ' . $time[1] . ' minutes');
} elseif (strpos($uptime[0], ':')) {
$time = explode(':', $uptime[0]);
echo('Current system uptime is ' . $time[0] . ' hours, ' . $time[1] . ' minutes');
@mcardillo55
mcardillo55 / escher.py
Created December 14, 2012 07:50 — forked from lecram/escher.py
#! /usr/bin/env python
"""{escher} -- one-file key-value storage.
What?
This is a toy application to manage persistent key-value string data.
The file {escher} is *both* the application and it's data.
When you run any of the commands bellow, the file will be executed and,
after data change, it will rewrite itself with updated data.
You can copy the file with whatever name to create multiple datasets.