Skip to content

Instantly share code, notes, and snippets.

View wizardishungry's full-sized avatar
🐫
Copyright 1987-2013, Larry Wall

Jon Williams wizardishungry

🐫
Copyright 1987-2013, Larry Wall
View GitHub Profile
@mattb
mattb / gist:3888345
Created October 14, 2012 11:53
Some pointers for Natural Language Processing / Machine Learning

Here are the areas I've been researching, some things I've read and some open source packages...

Nearly all text processing starts by transforming text into vectors: http://en.wikipedia.org/wiki/Vector_space_model

Often it uses transforms such as TFIDF to normalise the data and control for outliers (words that are too frequent or too rare confuse the algorithms): http://en.wikipedia.org/wiki/Tf%E2%80%93idf

Collocations is a technique to detect when two or more words occur more commonly together than separately (e.g. "wishy-washy" in English) - I use this to group words into n-gram tokens because many NLP techniques consider each word as if it's independent of all the others in a document, ignoring order: http://matpalm.com/blog/2011/10/22/collocations_1/

@luismayta
luismayta / CsrfProtect.php
Created October 30, 2012 00:39
CsrfProtect by zend framework
<?php
/**
* A controller plugin for protecting forms from CSRF
*
* Works by looking at the response and adding a hidden element to every
* form, which contains an automatically generated key that is checked
* on the next request against a key stored in the session
*
* @author Jani Hartikainen <firstname at codeutopia net>
*/
@ndfred
ndfred / install_airport_utility_5.6.1.sh
Created November 8, 2012 22:22
Download and install the Airport Utility 5.6.1 app on Mac OS X Lion and up
#!/bin/sh -e
# Download and install the Airport Utility 5.6.1 app on Mac OS X Lion and up
if [ ! -d "/Applications/Utilities/AirPort Utility 5.6.1.app" ]
then
[ -d /Volumes/AirPortUtility ] && hdiutil detach /Volumes/AirPortUtility
rm -rf /tmp/AirPortUtility5.6.1.dmg /tmp/AirPortUtility5.6.1
echo "Downloading Airport Utility 5.6.1"
@mrmt
mrmt / follow-back.pl
Created December 1, 2012 02:31
following back my twitter followers
#!/usr/bin/perl
# following back my twitter followers
# get consumer keys and access token from http://dev.twitter.com/apps/new
use utf8;
use strict;
use warnings;
use Net::Twitter;
use YAML::Tiny;
sub usage{
@purem
purem / Wolfram alpha named parametric curves
Created January 31, 2013 23:05
Wolfram alpha named parametric curves
Enter into wolfram alpha to draw
witch of Agnesi
ampersand curve
Archimedean spiral
Archimedes' spiral
astroid
astroid pedal curve
atriphtaloid
bean curve
@mwunsch
mwunsch / emoji_image_replace.js
Last active August 13, 2023 21:44
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
@shanselman
shanselman / gist:5422230
Last active March 28, 2024 10:33
Evil Blog Comment Spammer just exposed his template through some error and the whole thing showed up in my comments.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|
@yanofsky
yanofsky / LICENSE
Last active February 25, 2024 12:21
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit

Download and convert data from NYC open data portal

curl -o nynta.zip "https://nycopendata.socrata.com/api/geospatial/cpf4-rkhq?method=export&format=Shapefile"
cd nynta_12c

ogr2ogr can't deal with the projection directly. Replace content of nynta.prj with the following projection string:

PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["lambert_conformal_conic_2sp"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["longitude_of_center",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["latitude_of_center",40.16666666666666],UNIT["Foot_US",0.3048006096012192]]

@jcs
jcs / gist:5573685
Last active April 2, 2024 20:18
macOS FileVault encryption and OpenBSD encrypted softraid on a Macbook Air/Pro

Update (2019-05-06): The Broadcom wireless card in the MacBook Pro works and can be crammed into the Air.

Update (2015-12-04): This document used to be very lengthy as there were many manual steps required to get OpenBSD and Mac OS X working together through Boot Camp Assistant (BCA), which created a hybrid MBR and enabled a legacy BIOS emulation mode which older versions of Windows (and OpenBSD) required. Newer Macbooks stopped supporting older versions of Windows through BCA and now only support Windows 10 since it uses GPT and UEFI. However, now that newer versions of OpenBSD support GPT and UEFI, Boot Camp Assistant is no longer needed at all to boot OpenBSD.

macOS FileVault encryption and OpenBSD encrypted softraid on a Macbook Air/Pro

OpenBSD works pretty well on at least the Mid-2011 Macbook Air (A1370, SandyBridge) and Mid-2013 Macbook Air (Haswell). The new KMS code in 5.4 brings up the MBA's eDP display in 1366x768 with backlight