Skip to content

Instantly share code, notes, and snippets.

View emilssolmanis's full-sized avatar
🥔

Emils Solmanis emilssolmanis

🥔
View GitHub Profile

Keybase proof

I hereby claim:

  • I am emilssolmanis on github.
  • I am esmupliks (https://keybase.io/esmupliks) on keybase.
  • I have a public key whose fingerprint is 0E37 900F 3AA7 C7B5 33C7 FF63 CF43 8B91 83BC FD48

To claim this, I am signing this object:

function handle_request(code, data)
if code < 0 then
print("failed to post http")
do_it()
else
print("score, sleeping for 1 hour")
node.dsleep(4294967295, nil)
end
end
@emilssolmanis
emilssolmanis / example-output.json
Last active August 29, 2015 14:18
Tornado stack_context live call data example
{
"_debug": [
{
"kwargs": {},
"time": 1.8904321193695068,
"name": "get_impl:6cf3e692-2e98-45ae-bfd4-597c47851b0b",
"calls": [
{
"kwargs": {},
"time": 0.5965301990509033,
@emilssolmanis
emilssolmanis / walk-the-etcd-realm.py
Created October 29, 2014 23:25
Fetch all values from etcd
import urllib2
import json
import sys
ROOT = 'http://localhost:4001/v2/keys'
def walk_this_way(path):
response = urllib2.urlopen(ROOT + path)
@emilssolmanis
emilssolmanis / expedia-scrape.js
Created May 10, 2014 09:25
Expedia result scraping
$('.segment-result').each(function(i, flightModule) {
function getText(selector) {
return $(selector, flightModule).text().trim().replace(/\s+/g, ' ');
}
var srcCode = getText('[data-test-id=departureAirportCode]');
var destCode = getText('[data-test-id=arrivalAirportCode]');
var srcTime = getText('[data-test-id=departureTime]');
var destTime = getText('[data-test-id=arrivalTime]');
var duration = getText('[data-test-id=duration]').replace(',', '');
var price = getText('.offer-price > span').replace(',', '');
@emilssolmanis
emilssolmanis / gist:2656401
Created May 10, 2012 22:44
Python2 - Xlib, mouse move
# by Daniel Baggio, http://danielbaggio.blogspot.com/2009/03/python-mouse-move-in-5-lines-of-code.html
from Xlib import X, display
d = display.Display()
s = d.screen()
root = s.root
root.warp_pointer(300,300)
d.sync()
@emilssolmanis
emilssolmanis / open_remote_tabs.sh
Created March 10, 2012 18:14
Open tabs opened on a remote host locally in Opera
# The temp file is needed to avoid infinite loop cases, Opera writes to the
# autosave file when it opens a new tab. While technically this shouldn't
# happen if you open from a remote host, better safe than sorry.
function open_tabs_from {
ssh $1 "fgrep -A2 \"history url\" ~/.opera/sessions/autosave.win | grep 0= | cut -d \"=\" -f 2-" > /tmp/opera.tabs
cat /tmp/opera.tabs | xargs -I{} opera -newtab {}
rm /tmp/opera.tabs
}