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
package fd; | |
import java.io.Console; | |
import java.util.ArrayList; | |
import java.util.Calendar; | |
import org.openrdf.model.impl.StatementImpl; | |
import org.openrdf.model.impl.URIImpl; | |
import org.openrdf.query.QueryLanguage; | |
import org.openrdf.repository.RepositoryConnection; | |
import org.openrdf.repository.http.HTTPRepository; |
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
if is_running("Terminal") then | |
tell application "System Events" | |
tell process "Terminal" | |
tell menu bar 1 | |
tell menu "Shell" of menu bar item "Shell" | |
tell menu item "Linux" of menu "New Tab" of menu item "New Tab" to click | |
end tell | |
end tell | |
end tell | |
tell window 1 of application "Terminal" to activate |
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
<VirtualHost xxx.xxx.xxx.xxx:80> | |
RedirectMatch ^/dashboard$ https://myhost/dashboard/ | |
RedirectMatch ^/dashboard/$ https://myhost/dashboard/ | |
RedirectMatch ^/dashboard/(.*)$ https://myhost/dashboard/$1 | |
</VirtualHost> | |
<VirtualHost 127.0.0.1:80> | |
ServerName myhost | |
DocumentRoot /var/www/html | |
RailsBaseURI /dashboard |
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
[loggers] | |
keys = root | |
[handlers] | |
keys = console | |
[formatters] | |
keys = generic | |
[logger_root] |
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
from scipy.spatial import kdtree | |
import itertools | |
import random | |
import time | |
random.seed(1) | |
data = list(itertools.permutations(range(30), 4)) | |
random.shuffle(data) | |
print "Data contains", len(data), "elements." |
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 subprocess | |
p = subprocess.Popen("cat", stdin=subprocess.PIPE, stdout=subprocess.PIPE) | |
chunk = 1024 | |
count = 0 | |
while True: | |
p.stdin.write("0" * chunk) | |
count += chunk | |
print count |
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 time | |
def f(x): | |
return x + 1 | |
def z(x): | |
pass | |
def g(x): | |
z(x) |
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
# -*- encoding: utf-8 -*- | |
import sys | |
__all__ = ['proc_stat'] | |
_pstat_parts = [ | |
('pid', int), | |
('comm', str), | |
('state', str), |
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
CmdUtils.makeSearchCommand({ | |
names: ["yandex"], | |
icon: "http://www.yandex.ru/favicon.ico", | |
description: "Поиск в Yandex", | |
author: {name: "Lev Shamardin", email: "shamardin@gmail.com"}, | |
url: "http://yandex.ru/yandsearch?text={QUERY}&lr=1", | |
preview: function(pblock, {object}) { | |
var searchTerm = object.text; | |
var template = "Поиск в yandex: <b>${query}</b>"; | |
var data = {query: searchTerm}; |
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 os, re, sys | |
r = re.compile(r'abc xyz = "(.*)"') | |
def matches(f): | |
return ['%s:%s' % (f, m.group(1)) for m in (r.match(l) for l in open(f, "r")) if m] | |
for fn in (fn for fn in os.listdir(len(sys.argv) > 1 and sys.argv[1] or '.') if os.path.isfile(fn)): | |
rc = matches(fn) | |
if rc: print "\n".join(rc) |