Skip to content

Instantly share code, notes, and snippets.

View toolness's full-sized avatar

Atul Varma toolness

View GitHub Profile
@toolness
toolness / crypter.js
Created March 24, 2014 12:13
Noobish attempt at making a password-based encryption/decryption mini-library in node.
var crypto = require('crypto');
var CIPHERS = {
'aes256': {
blockSize: 128 / 8,
keySize: 256 / 8
}
};
var HASHES = {
@toolness
toolness / programming-questions.md
Last active August 29, 2015 13:57
My response to a friend's questions about programming

Following is a response to a friend's questions about the following:

If Ruby and Python are programming languages, what is HTML? Is that a programming language too?

If you are writing HTML, are you not writing in Ruby or Python?

Or is HTML the base and then Ruby or Python somehow builds on it?

All of the websites explain how to use all of this stuff but none of them explain the very basics of what this all means and how the pieces fit together.

@toolness
toolness / minicade.yaml
Created April 19, 2014 12:36
Sample Minicade Gist
title: My Example Minicade-in-a-gist
games:
- title: Flyswat
description: Swat the fly before time runs out!
url: http://toolness.github.io/fancy-friday/example/game-01.html
@toolness
toolness / pbpaste.py
Last active August 29, 2015 14:01
ctypes-based Python version of OS X's pbpaste command for Windows.
import sys
import ctypes
# This is adapted from code found via:
# http://nullege.com/codes/search/ctypes.windll.user32.OpenClipboard
ctypes.windll.user32.OpenClipboard(0)
pcontents = ctypes.windll.user32.GetClipboardData(1) # 1 is CF_TEXT
data = ctypes.c_char_p(pcontents).value
ctypes.windll.user32.CloseClipboard()
@toolness
toolness / youtube-to-mp3-Dockerfile
Last active August 29, 2015 14:04
A Dockerfile that makes it easy to convert youtube videos to mp3's
FROM ubuntu:14.04
MAINTAINER Atul Varma
RUN printf '\ndeb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse' >> /etc/apt/sources.list
RUN printf '\ndeb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse' >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y libav-tools libavcodec-extra-54 python python-pip
RUN pip install --upgrade youtube_dl
@toolness
toolness / hive-directory-listing.php
Created August 14, 2014 19:34
Wordpress plugin to list Hive member organizations from a Hive Directory server.
<?php
/**
* @package Hive_Directory_Listing
* @version 1.0
*/
/*
Plugin Name: Hive Directory Listing
Plugin URI: http://github.com/toolness/hive-django
Description: This is a plugin that integrates your WordPress site with the Hive\
directory.
@toolness
toolness / baconjs-infinite-scroll.html
Last active August 29, 2015 14:05
An attempt to implement infinite scrolling using Bacon.js, a Functional Reactive Programming (FRP) library.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Bacon.js Infinite Scroll Attempt #2</title>
<p>Keep scrolling down to see more numbers.</p>
<div id="results"></div>
<img id="throbber" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif" style="position: fixed; bottom: 4px; right: 4px;">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.22/Bacon.js"></script>
<script>
var pageChanged = new Bacon.Bus();
@toolness
toolness / feminism-faq.md
Last active August 29, 2015 14:07
Feminism FAQ

This page was a compilation of research answering questions on thewomansplainer.com, as well as some of my own.

Due to a number of tweets accusing me of stealing business from thewomansplainer.com, I've moved this document to a private gist.

@toolness
toolness / jsbin-proxy.js
Created January 29, 2015 05:46
JS Bin Proxy
var http = require('http');
var urlParse = require('url').parse;
var PORT = process.env.PORT || 3000;
http.createServer(function(req, res) {
var info = urlParse(req.url);
if (req.method != 'GET') {
res.writeHead(405);
@toolness
toolness / guess_the_number.rs
Created March 15, 2015 16:31
Guess The Number in Rust
#![feature(old_io)]
#![feature(rand)]
#![allow(deprecated)]
use std::cmp::Ordering;
use std::old_io;
use std::rand;
fn cmp(a: u8, b: u8) -> Ordering {
if a > b {