Skip to content

Instantly share code, notes, and snippets.

View Lyken17's full-sized avatar
🎯
Focusing

Ligeng Zhu Lyken17

🎯
Focusing
View GitHub Profile
import numpy as np
def fibonacci(n):
def fast_mod(base, exp, mod):
base = base % mod
res = 1
while exp > 0:
if exp & 1:
res = (res * base) % mod
base = base * base % mod
import numpy as np
def fibonacci(n):
def fast_mod(base, exp, mod):
base = base % mod
res = 1
while exp > 0:
if exp & 1:
res = (res * base) % mod
base = base * base % mod
This file has been truncated, but you can view the full file.
Log file created at: 2016/04/25 16:53:20
Running on machine: cs-gpu01
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I0425 16:53:20.257540 6192 caffe.cpp:184] Using GPUs 0
I0425 16:53:22.505061 6192 solver.cpp:48] Initializing solver from parameters:
test_iter: 10
test_interval: 250
base_lr: 0.001
display: 20
max_iter: 120000
{- Version 1, 'untyped' -}
data Color = R | B deriving Show
data RB a = E | T Color (RB a) a (RB a) deriving Show
{- Insertion and membership test as by Okasaki -}
insert :: Ord a => a -> RB a -> RB a
insert x s =
T B a z b
where
T _ a z b = ins s
@Lyken17
Lyken17 / t.py
Created August 5, 2016 21:51
Input of hackerrank
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
@Lyken17
Lyken17 / tarjan.cpp
Created August 13, 2016 01:24
tarjan algorithm
void tarjan(int i)
{
int j;
DFN[i]=LOW[i]=++Dindex;
instack[i]=true;
Stap[++Stop]=i;
for (edge *e=V[i];e;e=e->next)
{
j=e->t;
if (!DFN[j])
@Lyken17
Lyken17 / tensorflow_cuda_osx.md
Created August 24, 2016 10:32 — forked from Mistobaan/tensorflow_cuda_osx.md
How to enable cuda support for tensor flow on Mac OS X (Updated on April:2016 Tensorflow 0.8)

These instructions will explain how to install tensorflow on mac with cuda enabled GPU suport. I assume you know what tensorflow is and why you would want to have a deep learning framework running on your computer.

Prerequisites

Make sure to update your homebrew formulas

brew update
@Lyken17
Lyken17 / rerank.py
Last active November 27, 2016 11:20
mistakes = 0
for i in range(epochs):
for nbest in nbests:
def get_sample():
sample = []
for i in range(tau):
# s1, s2 = random.sample(nbest, 2)
s1 = random.choice(nbest)
s2 = random.choice(nbest)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
for i in range(0, epochs):
mistakes = 0
np_mistakes = 0
np_mistakes2 = 0
sys.stderr.write("Epoch %s...\n" % i)
# sys.stderr.write("length of nbests is %s and first is %s\n" % (len(nbests), len(nbests[0])))
for nbest in nbests:
def get_sample():
sample = []