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, string | |
from collections import defaultdict | |
types = {'char': 'string', | |
'nchar': 'string', | |
'varchar': 'string', | |
'lvchar': 'string', | |
'text': 'string', | |
'clob': 'string', | |
'bigint': 'long', |
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, stat, shutil, re | |
for author in [author for author in os.listdir('.') if os.path.isdir(os.path.join('.', author))]: | |
lastbook = {} | |
for book in [re.search('(?P<title>.*)\s?\((?P<id>\d+)\)', book).groupdict() for book in os.listdir(author + '/.') if os.path.isdir(os.path.join('.', author + '/' + book))]: | |
if book['title'] in lastbook: | |
if float(book['id']) > float(lastbook[book['title']]): | |
lastbook[book['title']] = book['id'] | |
else: | |
lastbook[book['title']] = book['id'] |
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
ssh -c arcfour,blowfish-cbc -XC [server] chromium --incognito |
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/python | |
#-*-coding:utf-8-*- | |
import re, string, os | |
inddtags = re.compile('@\S+') | |
xmltags = re.compile("""<(?:([a-zA-Z\?][\w:\-]*)(\s(?:\s*[a-zA-Z][\w:\-]*(?:\s*=(?:\s*"(?:\\"|[^"])*"|\s*'(?:\\'|[^'])*'|[^\s>]+))?)*)?(\s*[\/\?]?)|\/([a-zA-Z][\w:\-]*)\s*|!--((?:[^\-]|-(?!->))*)--|!\[CDATA\[((?:[^\]]|\](?!\]>))*)\]\])>""") | |
cleanup = re.compile('[^a-zA-Z0-9\n ]+') | |
smash = re.compile('(\S+){16}') | |
inputfile = open('1.indd', 'rb') |
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
$commitlog = '<!doctype html><html><body>' | |
foreach($line in git log --no-merges --pretty=%H%n%B){ | |
if ($line -match '\w{40}') { | |
$commit = git show $line -- Properties/AssemblyInfo.cs | |
[string] $vers = $commit -match '\+\[assembly: AssemblyVersion\("(\d\.\d\.\d\.\d)"\)\]' | |
if ($vers) { | |
$vnum = $vers.Split('\"')[1] | |
if ($vnum) { | |
$line = '<hr><span class="version">Version ' + $vnum + ':</span>' | |
} else { |
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
git filter-branch --commit-filter ' | |
if [ "$GIT_COMMITTER_EMAIL" = "old@email" ]; | |
then | |
GIT_COMMITTER_NAME="Full Name"; | |
GIT_AUTHOR_NAME="Full Name"; | |
GIT_COMMITTER_EMAIL="new@email"; | |
GIT_AUTHOR_EMAIL="new@email"; | |
git commit-tree "$@"; | |
else | |
git commit-tree "$@"; |
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
var inputNames = new [] { "Ann Boelyn", "King Henry VIII", "Charles of Macedonia", "Edgar J. Hoover", "Birkenstock", "Teenage Mutant Ninja Turtles", "Henry Ford Sr.", "Alexander the Great Jr.", "Sir Ixion Galahad", "W. Bryan Cranston, Jr.", "Neil Patrick-Harris", "Harold & Kumar", "Tipsy/Topsy/Turvy", "Eddard, House of Stark", "Jay Z"}.ToList(); | |
var excludeList = new [] { ",", "/", "&", "@", "(", ")" }.ToList(); | |
var matchNames = new List<string>(); | |
TextInfo textInfo = Thread.CurrentThread.CurrentCulture.TextInfo; | |
foreach (var name in inputNames) | |
{ | |
if (!excludeList.Any(name.Contains)) | |
{ | |
var cleanName = Regex.Match(name, @"(.+?)(\s(?:I|II|III|Jr|Sr)?(?:\.)?)?$").Groups[1].Value; | |
var match = Regex.Match(cleanName, @"^(\S+) (?:(?:\S.\ )|(?:\S+ ))?(\S+)"); |
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
public class MyContext : DbContext | |
{ | |
public MyContext () | |
: base(ContextHelper.CreateConnection("my connection string"), true) | |
{ | |
((IObjectContextAdapter)this).ObjectContext.CommandTimeout = 300; | |
} | |
} |
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
select afield1,count(afield1) from atable | |
group by afield1 having count(afield1) > 1 |
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 Master; | |
GO | |
ALTER DATABASE AnnoyingDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE | |
GO | |
DROP DATABASE AnnoyingDB; | |
GO |
OlderNewer