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 requests | |
import time | |
import pprint | |
import os | |
from PIL import Image | |
'https://developers.facebook.com/tools/explorer/' | |
access_token = '' |
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
>>> l = range(1, 7) | |
>>> pairs = list(itertools.product(l, repeat=2)) | |
>>> pairs = list(filter(lambda x: x[0] != x[1], pairs)) | |
>>> l = list(itertools.combinations(pairs, 3)) | |
>>> c = set(map(lambda x: frozenset(map(lambda y: frozenset(y), x)), l)) | |
>>> len(set(filter(lambda x: len(set(list(itertools.chain(*list(map(lambda y: list(y), x)))))) is 6, c))) | |
15 | |
>>> l[:5] | |
[((1, 2), (1, 3), (1, 4)), ((1, 2), (1, 3), (1, 5)), ((1, 2), (1, 3), (1, 6)), ((1, 2), (1, 3), (2, 1)), ((1, 2), (1, 3), (2, 3))] | |
>>> list(c)[:5] |
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
#!/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
#!/usr/bin/env python3 | |
__author__ = 'Sushain K. Cherivirala' | |
import argparse | |
import cmd | |
import collections | |
import contextlib | |
import copy | |
import datetime |
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
$ ./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
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
while true; do inotifywait . -r -e MODIFY && make debug -j32; done; | |
while true; do fswatch -o -r . | make debug -j32; 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
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], |