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 IPython.display import display | |
from JSAnimation.IPython_display import display_animation | |
from matplotlib import animation | |
def run_env_steps(env, num_steps=1000): | |
env.reset() | |
frames = [] | |
for _ in range(num_steps): | |
# Render into buffer. | |
# You will still see the window. |
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
# 1 "chia.c" | |
# 1 "<built-in>" | |
# 1 "<command-line>" | |
# 1 "/usr/include/stdc-predef.h" 1 3 4 | |
# 1 "<command-line>" 2 | |
# 1 "chia.c" | |
# 49 "chia.c" | |
int N=0,_,O=328,l=192,y=4,Y[80][64]={0},I;struct LameJavaApp | |
{ |
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
curl -sk https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash | |
git clone https://github.com/torch/distro.git ~/torch --recursive | |
cd ~/torch; ./install.sh |
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
su- | |
apt-get install cabal-install && clementine | |
cabal install xmonad && xmobar --flags="all_extensions" |
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
#based on idea that none of the prefixes of | |
#maximal sum array can be negative(interesting, isn't it) | |
def maxSubArray(self, A): | |
cursum = 0 | |
maxsum = -999999999999 | |
for item in A: | |
cursum += item | |
maxsum = max(cursum, maxsum) | |
if cursum < 0: | |
cursum = 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
param = {} | |
param['booster'] = 'gbtree' | |
param['objective'] = 'multi:softprob' | |
param['eval_metric'] = 'mlogloss' | |
param['num_class'] = 9 | |
param['silent'] = 1 | |
param['nthread'] = 1 | |
num_round = 5000 | |
plst = list(param.items()) |
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
open System | |
open System.IO | |
open Microsoft.FSharp.Core | |
let ReadLines fn = | |
seq { use inp = File.OpenText fn in | |
while not(inp.EndOfStream) do | |
yield(inp.ReadLine()) | |
} |
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
#include <vector> | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
struct pt { | |
double x, y; | |
pt operator- (pt p) { |
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
su - | |
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list | |
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 | |
apt-get update | |
apt-get install oracle-java8-installer | |
exit |
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 Data.List | |
maximum' :: (Ord a) => [a] -> a | |
maximum' [] = error "maximum of empty list" | |
maximum' [x] = x | |
maximum' (x:xs) = max x (maximum' xs) | |
replicate' :: (Num i, Ord i) => i -> a -> [a] | |
replicate' n x | |
| n <= 0 = [] |
NewerOlder