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
-- @betaveros | |
-- Google Code Jam Round 1A 2014: Proper Shuffle (polished version) | |
import Control.Applicative | |
import Control.Monad | |
import Text.Printf | |
inputInt :: IO Int | |
inputInt = read <$> getLine | |
inputInts :: IO [Int] | |
inputInts = map read . words <$> getLine |
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
import java.awt.image.BufferedImage | |
import java.io.File | |
import java.awt.Color | |
import javax.imageio.ImageIO | |
object ImageTabler { | |
var classMap: Map[Int, Int] = Map() | |
var nextClass: Int = 1 | |
def addClassFor(c: Int): Unit = if (!(classMap contains c)) { | |
var cls = nextClass |
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 ruler | |
set showcmd | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
set autoindent | |
filetype plugin indent on | |
let mapleader = "," |
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
import codecs | |
import os | |
import shutil | |
import zipfile | |
def magic(fname): | |
if type(fname) == unicode: return fname | |
assert type(fname) == str | |
return codecs.decode(fname, 'shift-jis', 'replace') |
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
% underblank.sty: Blanks for tests and study guides and all that multiverse cr&p | |
% to get the answers, declare a command \underblankanswers to anything. | |
\ProvidesPackage{underblank} | |
\usepackage{ulem} | |
\usepackage{ifthen} % need 2 versions: w/, w/o answers | |
\normalem | |
\newlength{\answerwidth} | |
\newcommand{\emptyline}{\vspace{\baselineskip}} | |
\newcommand{\underblank}[2]{\settowidth{\answerwidth}{#1}\uline{\makebox[\answerwidth][c]{#2}}} |
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 python | |
# nontrivial parts come from | |
# http://paste.pound-python.org/raw/6aCbTG3lKgCWdrRygkBG/ | |
# tmux magic incantation: | |
# bind-key v command-prompt -p "Enter digraph:" "set-buffer \"%%\"; save-buffer /tmp/tmux-digraph-input; delete-buffer; if-shell 'digraph.py < /tmp/tmux-digraph-input > /tmp/tmux-digraph-output' 'load-buffer /tmp/tmux-digraph-output; paste-buffer -d; run-shell \"rm /tmp/tmux-digraph-output /tmp/tmux-digraph-input\"' 'display-message \"Error in digraph lookup\"'" | |
import logging | |
import os.path | |
import sys | |
import unicodedata |
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
from __future__ import division, print_function | |
H=1.008; He=4.002602; | |
Li=6.94; Be=9.012182; B=10.81; C=12.011; N=14.007; O=15.999; F=18.9984032;Ne=20.1797; | |
Na=22.98976928;Mg=24.3050; Al=26.9815386;Si=28.085; P=30.973762; S=32.06; Cl=35.45; Ar=39.948; | |
K=39.0983; Ca=40.078; Sc=44.955912;Ti=47.867;V=50.9415; Cr=51.9961;Mn=54.938045;Fe=55.845; Co=58.933195;Ni=58.6934;Cu=63.546; Zn=65.38; Ga=69.723; Ge=72.63; As=74.92160; Se=78.96; Br=79.904; Kr=83.798; | |
Rb=85.4678; Sr=87.62; Y=88.90585; Zr=91.224;Nb=92.90638; Mo=95.96; Tc=98.0; Ru=101.07; Rh=1 |
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
public class Troll { | |
static volatile int a; | |
public static void main(String[] args) { | |
new Thread(new Runnable(){ | |
public void run(){ | |
while (true){ a = -42; a = 1337; } | |
} | |
}).start(); | |
for (int i = 0; i < 1000000; i++){ | |
if (a != a) { |
OlderNewer