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 sys | |
limit = 5 if not len(sys.argv) > 1 else int(sys.argv[1]) | |
found = {} | |
toler = 10 ** -5 | |
energy = 1 | |
while not set(found.keys()) >= set(range(1, limit + 1)): | |
states = [] | |
for nx in range(1, int(energy ** .5) + 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
#!/usr/bin/env python3 | |
import sys, argparse, urllib.request, urllib.parse, json, logging, random | |
from datetime import datetime | |
dateFormat = '%m-%d-%y' | |
def getAPIResponse(url, apiKey, data={}): | |
params = {'apikey': apiKey} | |
params.update(data) |
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 random, itertools | |
from fractions import Fraction | |
#Squares | |
a = range(1, 26) + range(20, 26) | |
random.shuffle(a) | |
print('\n'.join(map(lambda x: str(x).rjust(2) + '² = ' + '_' * 15, a))) | |
#Cubes |
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
function addVisitToCalendar(event) { | |
var calendarName = 'sushain@skc.name', //The default calendar name = email address (?) | |
eventLocation = 'College Center', | |
collegeName = 'College Name', | |
startTime = 'Start Time', | |
endTime = 'End Time', | |
description = 'Notes'; | |
var values = event.namedValues; | |
var event = CalendarApp.getCalendarsByName(calendarName)[0].createEvent(values[collegeName], |
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
$ ./localisation-tools.py cleanup `find . -regextype sed -regex ".*/[a-z]\{3\}\.json" -printf "%f "` && grep "completion" *.json | sort -nrk1.33,1.35 -nrk1.38,1.43 | awk -F '"' 'BEGIN {print "{| class=\"wikitable\"\n|-\n!|code\n!|CBE*\n!|CBC**" } {sub(/\..*$/, "", $1); split($4, s, " "); print "|-\n|| " $1 " || " s[1] " || " s[2]} END { print "|}\n\n *CBE: completion by entries <br>\n **CBC: completion by characters"}' |
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
require "Digest" | |
require "pp" | |
files = Dir.entries("#{ARGV.first}").select { |f| !File.directory? "#{ARGV.first}#{f}" } | |
filehashes = Hash[files.map { |f| [f, Digest::MD5.file("#{ARGV.first}#{f}").hexdigest] }] | |
grouped = filehashes.group_by{ |k, v| v }.keep_if{ |_, e| e.length > 1 } | |
PP.pp(grouped) |
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 python3 | |
import argparse, os, lxml.etree, lxml.builder, re, collections, mimetypes, bz2, logging, json | |
def validFile(fname): | |
if not os.path.isfile(fname): | |
raise argparse.ArgumentError('File %s does not exist!' % fname) | |
return fname | |
numeral_map = tuple(zip( |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"> | |
<meta name="author" content="Sushain K. Cherivirala (www.skc.name)"> | |
<title>Bridge Project Leaderboard</title> | |
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.3.5/tabletop.js"></script> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> | |
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> |
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
irb(main):040:0> xml = `svn log --xml https://svn.code.sf.net/p/apertium/svn/#{ARGV[0]}/apertium-#{ARGV[1]}`; nil | |
=> nil | |
irb(main):041:0> require 'nokogiri' | |
=> true | |
irb(main):042:0> doc = Nokogiri::XML(xml); nil | |
=> nil | |
irb(main):043:0> authors = Hash.new(0) | |
=> {} | |
irb(main):044:0> doc.xpath("//author").each { |author| authors[author.text] += 1 } | |
=> 0 |
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
sudo apt-get update && sudo apt-get install subversion build-essential pkg-config gawk libxml2 libxml2-dev libxml2-utils xsltproc flex automake libtool libpcre3-dev zlib1g-dev libboost-dev libgoogle-perftools-dev libicu-dev cmake python3 python3-dev python3-lxml python3-requests python3-tornado python3-pip gedit gedit-plugins vlc default-jdk default-jre curl sqlite3 vim chromium-browser xchat curl sqlite3 inotify-tools git && sudo apt-get upgrade |
OlderNewer