This file contains hidden or 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
{ | |
"metadata": { | |
"name": "Untitled1" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains hidden or 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
-module(ping_module). | |
-export([start/1, ping/2, pong/1, ending_timer/0]). | |
ping(0, Pong_PID) -> | |
Pong_PID ! finished, | |
io:format("ping finished~n", []); | |
ping(N, Pong_PID) -> | |
io:format("Sending ping~n", []), | |
Pong_PID ! {ping, self()}, |
This file contains hidden or 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
(use-modules (ice-9 popen)) | |
(weechat:register "piano" "MCConsALot" "0.1" "GPL3" "Control piano bar client" "" "") | |
(weechat:hook_command | |
"piano" "Control pianobar" | |
"[command]" "command to send to pianobar. Use /piano start, to begin" | |
"start next quit station send" | |
"main-command-handler" "") |
This file contains hidden or 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
# A sed script to convert HTML slides for reveal.js to markdown | |
# Assumes @@@\n is used for slide separator, and Note: is used for slide notes | |
# | |
# N.B. - Don't use regexes for HTML...ever. This is just a quick intro to sed | |
# and works for 90% of my needs for slides written in HTML (well-formed). This | |
# breaks pretty crazily for nested HTML | |
# | |
# Usage: | |
# sed -f thisfilename filename.html > filename.md | |
/^ *$/d |
This file contains hidden or 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
DEFSNG A-Z | |
CLS | |
SCREEN 12 | |
xp = 320 | |
yp = 240 | |
num = 12 | |
DO | |
cad = 360 \ num |
This file contains hidden or 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/python | |
""" | |
A program that counts the number of occurences of words in a file. | |
Plain text books without copyright can be obtained from Project Gutenberg: | |
http://www.gutenberg.org/ | |
run 'python counter.py' to see the number of occurrences of the top 200 | |
most commonly used words |
This file contains hidden or 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
#!/bin/bash | |
function android_get_pkg() { | |
# Gets the name of the package | |
echo $(aapt dump badging $1 | | |
awk -F" " '/package/ {print $2}' | | |
awk -F"'" '/name=/ {print $2}' | |
) | |
} |
This file contains hidden or 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
from datetime import datetime | |
from django.db.models import get_model | |
from django.contrib.sites.models import Site | |
def reindex_homepage(site_id=2010, num=50, async=False): | |
layout_ids = find_homepage_layout_ids(site_id) | |
return reindex(layout_ids, num, async) |
This file contains hidden or 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
(define (repeat num arg) | |
(let inner ((current 0)) | |
(if (>= current num) | |
#nil | |
(cons arg (inner (1+ current)))))) | |
(define (make-range-stream min-x max-x step-x) | |
(let inner ((x min-x)) | |
(cons x (delay | |
(if (or (eq? x #nil) (>= (+ step-x x) max-x)) |
This file contains hidden or 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
(define (best-fit points) | |
;; Use least-squares estimation to find best fit line for given set of points | |
(let* ((sumx (apply + (map car points))) | |
(sumy (apply + (map cadr points))) | |
(sumxy (apply + (map (lambda (p) (* (car p) (cadr p))) points))) | |
(sumx2 (apply + (map (lambda (p) (* (car p) (car p))) points))) | |
(n (length points)) | |
(slope (/ (- sumxy (/ (* sumx sumy) n)) (- sumx2 (/ (* sumx sumx) n)))) | |
(y-int (/ (- sumy (* slope sumx)) n))) | |
(cons slope y-int))) |
OlderNewer