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
#include <iostream> | |
#include <cstdlib> | |
#include <cmath> | |
#include <sys/time.h> | |
#define ______________________ rand()/( | |
#define ____ int | |
#define _ RAND_MAX | |
#define ____________________(a)pow(a,2) | |
#define _____ ){ | |
#define __________________ atoi |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# INSTRUCTIONS: | |
# Install vagrant and virtualbox | |
# | |
# mkdir somewhere/sea | |
# cd $_ | |
# vagrant plugin install vagrant-vbguest | |
# <copy this file into this the directory> |
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 numpy import sin, cos, array, pi | |
from operator import matmul | |
from functools import reduce | |
def move(theta, s): | |
"""Generate a translation and rotation matrix from a given angle theta | |
and displacement s. The transformation rotates the whole coordinate | |
system either left or right, then moves us `s` steps north | |
Given a vector v = [ x y 1 ], and a tranformation matrix A, |
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
import sys | |
infile = sys.argv[1] | |
with open(infile, 'r') as f: | |
triples = (line.split(',') for line in f) | |
GRADES = [(int(t[1]), int(t[2])) for t in triples] | |
total_credits = sum(credits for (credits, _) in GRADES) |
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
defmodule Runlength do | |
defp encode([], cur_char, n, cur_encoded), do: "#{cur_encoded}#{n}#{<<cur_char>>}" | |
defp encode([h | tail], cur_char, n, cur_encoded) do | |
case h do | |
^cur_char -> encode tail, h, n + 1, cur_encoded | |
_ -> encode tail, h, 1 , "#{cur_encoded}#{n}#{<<cur_char>>}" | |
end | |
end | |
def encode(string) do |
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
⍝ extract only the parentheses from the character array ⍵ | |
⍝ | |
⍝ parens 'aa(bb)cc' | |
⍝ '()' | |
parens ← {(⍵∊'()')/⍵} | |
⍝ from a character array containing only '(' and ')', | |
⍝ map '(' to 1, and ')' to ¯1 | |
⍝ | |
⍝ open_close '()' |
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_module(library(clpfd)). % grab some matrix functions | |
% Herein we present facts about boards. | |
% Given these facts, the user can consult Prolog for interesting | |
% inferences based on these facts. | |
% Example consultation: | |
% | |
% › swipl facts.pl | |
% Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.1) |
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
⍝ An example board, the 4x4 reshape of a 16-vector | |
board ← 4 4 ⍴ 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0: | |
board | |
0 1 0 0 | |
0 1 0 0 | |
0 0 0 0 | |
0 0 0 0 |
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
import sys | |
import requests | |
URL = 'https://eventphone.de/guru2/phonebook?event=34C3&s=&page=1&format=json' | |
patterns = { | |
'doubled': lambda x: x[0] == x[1] and x[2] == x[3], | |
'alternate': lambda x: x[0] == x[2] and x[1] == x[3], | |
'end ten': lambda x: x[0] == x[1] and x[3] == '0', | |
'middle same': lambda x: x[1] == x[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
#!/usr/bin/swipl -f -q | |
:- initialization main. | |
% _ 1 | |
% |_| 234 | |
% |_| 567 | |
% _ _ _ _ _ _ _ _ | |
% | _| _||_||_ |_ ||_||_|| | | |
% ||_ _| | _||_| ||_| _||_| |
OlderNewer