This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import threading | |
from multiprocessing import Process,Queue,Pool | |
from gluon.shell import exec_environment | |
def parallelListDB(fun, lst, nthreads=2, request=None, | |
timeout=10, aggregate = lambda lst: it.chain(*lst)): | |
assert request!=None | |
q=Queue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Usage: dmesg | grep eth3 | dmesg_time.sh | |
for time in $(egrep -o '[0-9]+\.[0-9]+') | |
do | |
TIME="`echo "($(awk '{print $1}' /proc/uptime) - $time) / 60 / 60" | bc`h" # Hours | |
TIME="$TIME or `echo "($(awk '{print $1}' /proc/uptime) - $time) / 60" | bc`m" # Minutes | |
echo "$TIME ago" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To be run inside main sage-4.7.2 dir or alike | |
# Files TOFIX are usually those: | |
# local/bin/R local/lib/R/bin/libtool local/lib/R/bin/R local/lib/R/etc/ldpaths local/lib/R/etc/Makeconf local/lib/R/etc/Renviron | |
#Change here for different versions of sage | |
ORGPATH="/mnt/usb1/scratch/buildbot/sage/sage-1/sage_binary/build/sage-4.7.2" | |
DIR=`pwd` | |
SED="s|$ORGPATH|$DIR|g" | |
TOFIX=`grep -lI $ORGPATH -R local/ | grep /R` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
#Unique priority queues in Python | |
#@author: "Maciek Sykulski"<[email protected]> | |
#@blog: http://breakthecircles.blogspot.com/2013/10/unique-priority-queues-in-python.html | |
from Queue import PriorityQueue | |
import heapq | |
class UniquePriorityQueue(PriorityQueue): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a').filter(function(){ | |
return $(this).text() === 'Display Full Polymer Details'; | |
}) | |
.click() | |
$("span.se_key").filter(function(){ return $(this).text().match(' Gene Name[s]* ');}) | |
.parent().siblings("td.mdauData") | |
.map(function(){return $(this).parents("tbody.query").find("a.qrb_structid").text() | |
+"," | |
+$(this).text().trim().replace(/\s+/g,",");}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import praw | |
import getpass | |
import json | |
import csv | |
uname="yourusername" | |
fbase="reddit_saved" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# number of monitors | |
MONITORS=`xrandr | grep -w connected | wc -l` | |
# make a gap because of top panel | |
GAP_TOP=0 | |
GAP_BOTTOM=15 | |
#find x position of active window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################ | |
################ Parallel execution - helper functions for multicore library | |
################ Run jobs (expressions) in the background without blocking | |
################ | |
library(multicore) #better to be loaded last of all libraries | |
inpar<-function(name,expr){ | |
#Runs named expression in parallel with main thread - non-blocking | |
name<-deparse(substitute(name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Simple Python module to upload files to Google Drive | |
# Needs a file 'client_secrets.json' in the directory | |
# The file can be obtained from https://console.developers.google.com/ | |
# under APIs&Auth/Credentials/Create Client ID for native application | |
# To test usage: | |
# import google_drive_util | |
# google_drive_util.login() | |
# google_drive_util.test() |
OlderNewer