Skip to content

Instantly share code, notes, and snippets.

@segphault
segphault / gist:ed3b2ff224dfa4b908da
Created September 25, 2014 21:23
Applescript for automatic typing Alfred workflow
on alfred_script(q)
tell application "Google Chrome"
activate
tell application "System Events"
repeat with p in paragraphs of q
repeat with w in p
keystroke "" & w
delay (random number from 0.01 to 0.2)
end repeat
keystroke return
@segphault
segphault / app.js
Created January 18, 2015 22:22
Simple iOS app built with NativeScript
var application = require("application");
application.mainModule = "app/main";
application.start();
@segphault
segphault / monitor.go
Created February 5, 2015 22:48
A Go-based implementation of the RethinkDB cluster monitoring demo
package main
import (
"fmt"
r "github.com/dancannon/gorethink"
"github.com/googollee/go-socket.io"
"log"
"net/http"
)
@segphault
segphault / electiontrack.py
Created November 6, 2008 19:37
Retrieve data from Google's election tracker
#!/usr/bin/env python
import simplejson, urllib2
DATA_URL = "http://election2008.s3.amazonaws.com/votes/us-pres.json"
data = simplejson.loads(urllib2.urlopen(DATA_URL).read())
for candidate in data["totals"]["races"]["President"][""]["votes"]:
name = data["candidates"][candidate["id"]].split("|")[1]
@segphault
segphault / dropio_uploader.py
Created November 11, 2008 09:21
A tool for uploading files to Drop.io
#!/usr/bin/env python
# Drop.io Upload Tool for GNOME
# Copyright (C) 2008 Ryan Paul (SegPhault)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
@segphault
segphault / Main.fx
Created December 6, 2008 09:39
A Twitter search tool written in JavaFX
/*
* Main.fx
*
* Created on Dec 5, 2008, 11:27:35 AM
*/
package testapplication;
import javafx.scene.*;
import javafx.scene.image.*;
@segphault
segphault / gist.vim
Created December 9, 2008 08:25
VimGist - a plugin that integrates support for GitHub Gist in Vim
"
" Plugin: VimGist
" Author: SegPhault (Ryan Paul) - 12/08/2008
" Description: This plugin integrates support for GitHub Gist in Vim
"
python << EOF
import vim, sys, os.path
sys.path.append("/home/segphault/project/utilities/gist")
@segphault
segphault / gist:41169
Created December 29, 2008 04:03
Menu setup in GrabberSnap
def setup_menus(self):
ui_string = """
<ui>
<menubar name="menubarMain">
<menu action="menuFile">
<menuitem action="Capture"/>
<menuitem action="Open"/>
<menuitem action="Save"/>
<menuitem action="Upload"/>
<separator/>
@segphault
segphault / gist:41166
Created December 29, 2008 03:47
Manually set widget icons in GTK+
# Each individual GTK+ widget has a completely different set of functions for
# manually setting an icon. It also has to be done differently depending on
# whether the icon is being set by stock name or by filename. These
# inconsistencies make GTK+ very frustrating.
def set_icon_named(name, widget, size=gtk.ICON_SIZE_MENU):
if isinstance(widget, gtk.ImageMenuItem):
if name.startswith("/"): widget.get_image().set_from_file(name)
else: widget.get_image().set_from_icon_name(name, size)
@segphault
segphault / twittersearch.js
Created January 11, 2009 04:07
Twitter search demo for Seed
Seed.import_namespace("Gtk");
Seed.import_namespace("Gdk");
Seed.import_namespace("Gio");
Seed.include("pretty.js");
Gtk.init(null, null);
var window = new Gtk.Window({"title": "Twitter Search", "border-width": 5});
window.signal.hide.connect(Gtk.main_quit);