This file contains 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/env python2 | |
# https://www.youtube.com/watch?v=tIpKfDc295M | |
# https://www.youtube.com/watch?v=umAeJ7LMCfU | |
import numpy as np | |
f = lambda x, y: x * x + 2.0 * y | |
d_dx = lambda x, y: 2.0 * x | |
d_dy = lambda x, y: 2.0 |
This file contains 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/env python2 | |
# https://www.youtube.com/watch?v=YEBfamv-_do | |
from random import randrange | |
public_prime = 67280421310721 # aka p | |
public_base = 3 # aka g | |
def generate_key(): |
This file contains 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
// https://www.youtube.com/watch?v=_aWzGGNrcic | |
// https://www.youtube.com/watch?v=RD0nNK51Fp8 | |
import scala.io.Source | |
import scala.util.Random | |
import java.io.{BufferedWriter, FileWriter} | |
object Kmeans extends App { | |
case class Point(val x: Double, val y: Double) { |
This file contains 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
# This file is auto-generated from the current state of the database. Instead | |
# of editing this file, please use the migrations feature of Active Record to | |
# incrementally modify your database, and then regenerate this schema definition. | |
# | |
# Note that this schema.rb definition is the authoritative source for your | |
# database schema. If you need to create the application database on another | |
# system, you should be using db:schema:load, not running all the migrations | |
# from scratch. The latter is a flawed and unsustainable approach (the more migrations | |
# you'll amass, the slower it'll run and the greater likelihood for issues). | |
# |
This file contains 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
let val = 'global 1' | |
this.val = 'global 2' | |
console.log('val = ' + val) | |
class Foo { | |
constructor() { | |
this.val = 'property' | |
} | |
} |
This file contains 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
fix :: (a -> a) -> a | |
fix = \f -> f $ fix f | |
fib :: Int -> Int | |
fib = \n -> fix (\f n -> if n <= 2 then 1 else f (n - 2) + f (n - 1)) n | |
main = putStrLn $ show $ map fib [1..10] |
This file contains 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
set height 0 | |
set pagination off | |
set disassembly-flavor intel | |
# Don't wrap line or the coloring regexp won't work. | |
set width 0 | |
# Create a named pipe to get outputs from gdb | |
shell test -e /tmp/coloutPipe && rm /tmp/coloutPipe | |
shell mkfifo /tmp/coloutPipe |
This file contains 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
warning: file found to be present in multiple build targets: /tmp/quickcheck/quickcheck_macros/examples/attribute.rswarning: file found to be present in multiple build targets: /tmp/quickcheck/quickcheck_macros/examples/attribute.rs | |
Updating registry `https://github.com/rust-lang/crates.io-index` | |
Updating registry `https://github.com/rust-lang/crates.io-index` | |
Compiling regex-syntax v0.3.4 | |
Compiling regex-syntax v0.3.4 | |
Compiling winapi Compiling winapi v0.2.8 v0.2.8 | |
Compiling Compiling log v0.log v0.3.3.6 | |
6 |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
var colors = {}; | |
var elementsPerLine = 8; | |
function createSpanElement (color, text) { | |
var element = document.createElement('span'); | |
element.setAttribute('style', 'color:' + color); |
This file contains 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
// cc -std=c99 -g -O0 -Wall remove_all_spaces.c -o remove_all_spaces && gdb -ex r -ex q ./remove_all_spaces | |
// cc -DENABLE_BENCHMARK -std=c99 -O3 -Wall remove_all_spaces.c -o remove_all_spaces && ./remove_all_spaces | gnuplot -p - | |
#include <assert.h> | |
#include <ctype.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <time.h> |