Skip to content

Instantly share code, notes, and snippets.

mshock

  • San Francisco, CA
View GitHub Profile
@mshock
mshock / keep_awake.ahk
Created May 31, 2016
AutoHotkey script to keep Windows from sleeping
View keep_awake.ahk
SetTimer,KeepAwake,480000 ;run every 8 minutes
return
KeepAwake:
{
MouseMove,0,0,0,R ; mouse pointer stays in place but sends a mouse event
}
return
^0::
@mshock
mshock / flair_parse.cfg
Last active Mar 26, 2018
scrape user flair to sqlite db from posts within a subreddit
View flair_parse.cfg
[reddit]
client_id = XXX
client_secret = XXX
unique_key = XXX
@mshock
mshock / refresh_desktop.bat
Created Mar 10, 2016
get rid of annoying stuck context menu items in W2000-W7
View pig_latin.rb
def translate(str)
words = str.split(" ")
result_array = Array.new
words.each do |word|
if ( word.match(/^[aeiou]/) )
result_array.push( word + 'ay' )
else
done = false
consonants = ''
@mshock
mshock / k3.js
Created Oct 29, 2015
k3kc stock monitor - Google Apps Script
View k3.js
var max_errors = 5;
var EMAIL = Session.getActiveUser().getEmail();
var scriptProperties = PropertiesService.getScriptProperties();
//scriptProperties.deleteAllProperties();
function myFunction() {
var current_stock = {};
var shop_url = 'http://www.k3kc.com/shop/';
var links = new Array();
@mshock
mshock / fizzbuzz.pl
Created Apr 27, 2015
fizzbuzz in Perl using a generator
View fizzbuzz.pl
#! perl -w
use strict;
use List::Gen;
my $range;
$range = cache gen {$_} range 1, 100;
sub fizzbuzz {
my ($range, $triggers) = @_;
@mshock
mshock / clippy.cow
Created Apr 25, 2015
display Clippy whenever last command doesn't return success
View clippy.cow
##
## Milk from Milk and Cheese
##
$the_cow = <<EOC;
$thoughts ___
$thoughts / \\
$thoughts / \\
/ \\
___ ___
/___\\ /___\\
View iperf.sh
#!/bin/bash
if ! [ -x "$(type -P iperf)" ]; then
echo "ERROR: script requires iperf"
echo "For Debian and friends get it with 'apt-get install iperf'"
echo "If you have it, perhaps you don't have permissions to run it, try 'sudo $(basename $0)'"
exit 1
fi
if [ "$#" -ne "2" ]; then
@mshock
mshock / default.rb
Last active Aug 29, 2015
chef recipe for basic apache install
View default.rb
package "apache2" do
action :install
end
service "apache2" do
action [ :enable, :start ]
end
execute "mv /etc/apache2/sites-enabled/default-000.conf /etc/apache2/sites-available/default-000.conf.disabled" do
only_if do
@mshock
mshock / move_by_size.gs
Last active Aug 29, 2015
backup and delete original files by size in target directory - cleanup reddit wallpaper stash populated by IFTTT
View move_by_size.gs
function wallpaper_cleanup() {
var folder = DriveApp.getFoldersByName("wallpapers").next();
var small_folder = DriveApp.getFoldersByName("small_wallpapers").next();
var files = folder.getFiles();
while (files.hasNext()) {
var file = files.next();
if (file.getSize() < 200000) {
file.makeCopy(small_folder);
file.setTrashed(true);
Logger.log(file.getName() + file.getSize());
You can’t perform that action at this time.