Skip to content

Instantly share code, notes, and snippets.

@anemochore
anemochore / README.md
Created January 17, 2016 07:34
fresh block
@anemochore
anemochore / docker-tf.cmd
Last active June 24, 2016 06:17
commands for starting tensorflow in Windows
@echo off
rem First, install Docker toolbox for Windows.
rem cf. http://www.netinstructions.com/how-to-install-and-run-tensorflow-on-a-windows-pc/
set OLD_D=%cd%
cd /d "%DOCKER_TOOLBOX_INSTALL_PATH%"
start /min "Docker Toolbox" "%ProgramFiles%\Git\bin\bash.exe" --login -i start.sh
echo plz wait until 'Docker Toolbox' window finishes its initialization.
pause
FOR /f "tokens=*" %%i IN ('docker-machine env --shell cmd default') DO %%i
set DOCKER_HOST_HTTP=%DOCKER_HOST:~0,-4%
@anemochore
anemochore / html2docx.cmd
Created June 22, 2016 06:19
convert html to docx using pandoc
@echo off
rem first, install pandoc windows installer. see http://pandoc.org/
rem you may edit below extensions...
set INPUT_EXT=htm
set INPUT_EXT_ALT=html
set OUTPUT_EXT=docx
:start
@anemochore
anemochore / kh-factorial.js
Created November 24, 2016 00:59
만약 ㄹ혜가 자바스크립트로 코딩한다면
//제목: 만약 ㄹ혜가 자바스크립트로 코딩한다면
//알고리즘 문제: 팩토리얼(계승)
//작성자: ephemeral_truth@ausi.com
//아이디어: [만약 헤밍웨이가 자바스크립트로 코딩한다면]
function factorial(n) {
//비선실세에게 전화해서 계승 문제에 n을 넣으면 얼마인지 물어본다.
return 비선실세핫라인("계승", n);
}
@anemochore
anemochore / ch04_07.py
Last active January 5, 2017 05:05
파이썬으로 웹 크롤러 만들기_4장_097쪽 예제 전체 코드
from urllib.request import urlopen
from bs4 import BeautifulSoup
import datetime
import random
import re
random.seed(datetime.datetime.now())
def getLinks(articleUrl):
html = urlopen("http://en.wikipedia.org"+articleUrl)
bsObj = BeautifulSoup(html, "html.parser")
@anemochore
anemochore / 01_comb.py
Last active February 5, 2017 17:17
crude combination solution
def factorial(n):
if n <= 1:
return 1
else:
return n * factorial(n - 1)
def combination(n, k):
if k == 0 or n == k:
return 1
@anemochore
anemochore / crude cheese solution
Created February 3, 2017 05:42
03_cheese_rec.py
'''
# for debugging
def print_cells():
for y in range(n):
for x in range(m):
if cells[y][x] == -1:
print(" . ", end="")
elif cells[y][x] == 1:
print(" 1 ", end="")
else:
@anemochore
anemochore / 01_comb_dp.py
Created February 5, 2017 17:18
crude combination solution with dynamic programming
def factorial(n):
if factorial_array[n] > -1:
return factorial_array[n]
else:
factorial_array[n-1] = factorial(n - 1)
return n * factorial_array[n-1]
def combination(n, k):
if k == 0 or n == k:
@anemochore
anemochore / 02_fibo_dp.py
Created February 5, 2017 17:19
crude fibonacci solution
a = input()
if not a.isdigit() or len(a) == 0:
print('n should be a number')
quit()
n = int(a)
if n < 2:
print('n should be >= 2')
quit()
// for http://stackoverflow.com/questions/42160903/
var myFile = File.openDialog('select file');
myFile.open("r");
myFile.encoding = "binary";
var buffers = [];
for(var x=0; x<myFile.length; x += 4) {
myFile.seek(x, 0);
var buffer = "0x";
for(var y=0; y<4; y++) {