Skip to content

Instantly share code, notes, and snippets.

View Uberi's full-sized avatar

Anthony Zhang Uberi

View GitHub Profile
@Uberi
Uberi / normalize.py
Last active August 29, 2015 14:07
FaceBook chat data processing helper script. Run `normalize.py` to normalize the raw JSON data into cleaner JSON, then run `process.py` to calculate some interesting stats.
path = "data.json"
new_path = "normalized_data.json"
from urllib.parse import urlparse, parse_qs
import json
users = {
"fbid:100001608518631": "Anthony Zhang",
"fbid:1538370516": "Keri Warr",
"fbid:814604197": "Daniel Hopper",
@Uberi
Uberi / markov-single-word.py
Created October 2, 2014 04:30
Run the previous `normalize.py` on FB chat data, then run this script on its output to get sentences generated using a Markov chain.
path = "normalized_data.json"
user = "Keri Warr"
import json, sys, re
import random
from collections import defaultdict
data = json.load(open(path, "r"))
START, END = 0, 1
@Uberi
Uberi / Keri.html
Last active August 29, 2015 14:07
Keri.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>WARR NEVER CHANGES</title>
<style>
body {
background: black;
overflow: hidden;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Uberi
Uberi / LoadOBJ.ahk
Last active September 25, 2015 16:58
OBJ File Importer (AutoHotkey)
#NoEnv
/*
Usage:
LoadOBJ(A_ScriptDir . "\Mesh.obj")
*/
LoadOBJ(ByRef Mesh,ObjectName)
{
VerticesIndex := 1, TexCoordsIndex := 1, VertexNormalsIndex := 1
@Uberi
Uberi / Forum Functions.ahk
Created September 19, 2011 23:25
Forum Search - search the AutoHotkey forums programmatically.
#NoEnv
/*
Search := ForumSearch("","","Uberi",2) ;search the "Scripts & Functions" forum for topics by Uberi
TopicList := ""
For Index, Result In Search
{
If (Result.Author = "Uberi")
TopicList .= Result.Title . "`n"
@Uberi
Uberi / Natural Compare.ahk
Last active October 6, 2015 07:08
Natural comparison function, accounting for numeric values.
#NoEnv
A := "1.010"
B := "1.02"
Value := NaturalCompare(A,B)
If Value = -1
MsgBox, %A% < %B%
Else If Value = 1
MsgBox, %A% > %B%
Else
@Uberi
Uberi / gist:3165409
Created July 23, 2012 18:54
Google Cache Downloader
Search := "site:autohotkey.net/~Uberi filetype:ahk"
OutputPath := A_ScriptDir . "\CacheFiles"
Search := "http://www.google.com/search?q=" . URLEncode(Search)
Loop
{
SearchResult := Get(Search)
FoundPos := 1
While, FoundPos := RegExMatch(SearchResult,"S)<a href=""([^""]*)""[^>]*>Cached</a>",Match,FoundPos)