Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
cat all.json |
# curl 'http://www.khanacademy.org/api/v1/videos/localized/all' |
jq -r '
[
.[] |
{
title,
en_id:.youtube_ids["en"],
{-
The Look and Say sequence is an interesting sequence of numbers where each term is given by describing the makeup of the previous term.
The 1st term is given as 1. The 2nd term is 11 ('one one') because the first term (1) consisted of a single 1. The 3rd term is then 21 ('two one') because the second term consisted of two 1s. The first 6 terms are:
1
11
21
1211
111221
#!/usr/bin/env python3
import requests
import re
base_link = "http://apod.nasa.gov/apod/"
nasa_page = requests.get(base_link)
if(nasa_page.status_code != 200):
print("Failed to downlaod page")
nasa_page.raise_for_status()
extern crate rustc;
use rustc::middle::graph;
use std::collections::HashMap;
fn main() {
let mut g:graph::Graph<&str,int> = graph::Graph::new();
1A
CS 145
Math 145
Math 147
Econ 101
Phil 145
1B
CS 146
Math 146
Math 148
$pdf_previewer = "open -a Skim.app";
$pdflatex = 'xelatex %O %S';
$pdf_mode = 1;
$postscript_mode = $dvi_mode = 0;
#$aux_dir = 'aux';
$out_dir = 'out';
{-# LANGUAGE TemplateHaskell #-}
import Constructors
import Language.Haskell.TH
$( mkGetConstructors ''Foo )
main = do putStrLn $(stringE . show =<< getConstructorNames ''Foo)
(putStrLn.show) constructors
@tbelaire
tbelaire / titled_youtube
Created June 1, 2015 00:09
Download and `mpd add` youtube videos
#!/bin/bash
DLDIR=temp_youtube_downloads
# If there are errors, stop
set -e
if [[ $# < 1 ]]; then
echo "Usage: $0 youtube_url"
exit 1
use std::thread;
use std::sync::{Mutex, Arc};
use std::cell::Cell;
fn main() {
let x = Arc::new(Mutex::<i32>::new(0));
let handles: Vec<_> = (1..50).map(|i| {
let y = x.clone();
⚡ cargo run
Compiling phil v0.1.0 (file:///Users/tbelaire/Downloads/phil)
src/main.rs:16:5: 23:6 error: mismatched types:
expected `R`,
found `[closure src/main.rs:16:5: 23:6]`
(expected type parameter,
found closure) [E0308]
src/main.rs:16 || {
src/main.rs:17 loop {
src/main.rs:18 println!("philosopher {} is thinking...", i);