Skip to content

Instantly share code, notes, and snippets.

@donghee
donghee / mfdl.py
Created September 18, 2012 21:39
Mangafox Download Script
#!/usr/bin/python
'''Mangafox Download Script by Kunal Sarkhel <theninja@bluedevs.net>'''
'''Fix for new mangafox interface(2012.9) by Donghee Park'''
import sys
import os
import urllib
import glob
import shutil
@donghee
donghee / gist:3773082
Created September 23, 2012 21:22
Making chord
(load "libs/core/audio_dsp.xtm")
(load "libs/core/pc_ivl.xtm")
(load "libs/core/instruments.xtm")
(load "libs/external/instruments.xtm")
(define-instrument synth synth-note synth-fx)
(bind-func dsp:DSP
(lambda (in time chan dat)
(cond ((< chan 2.0)
@donghee
donghee / gist:3937661
Created October 23, 2012 08:36
emacs elisp: goto matching parenthesis
(defun jump-match-paren (arg)
"Go to the matching parenthesis."
(interactive "p")
(cond ((looking-at "\\s\(\\|\\s\[") (forward-list 1) (backward-char 1))
((looking-at "\\s\)\\|\\s\]") (forward-char 1) (backward-list 1))
(t (back-to-indentation))
))
(global-set-key [C-return] 'jump-match-paren)
@donghee
donghee / gist:3978270
Last active October 12, 2015 05:28
Door security system
#include "mbed.h"
Timer doorTimer;
InterruptIn openDoorEvent(p8);
DigitalOut buzzer(p5);
DigitalOut doorlight(p6);
DigitalIn alertSwitch(p7);
#define CLOSED 0
#define OPEN 1
@donghee
donghee / gist:3978755
Created October 30, 2012 07:17
Save temperature in eeprom 2
// TODO: tmp102 코드 정리 필요
// --+-------+--+-- 3.3v +--------+
// 24lc256 | | | |TMP102 |
// +--------+ | # # 1k pullups |SCL SDA|
// +-- A0 -| 1 8 |- VDD --+ # # |--+--+--|
// +-- A1 -| 2 7 |- WP ----- p29 | | | |
// +-- A2 -| 3 6 |- SCL ----------+--|-----------------+--|----------- p27
// +- GND -| 4 5 |- SDA -------------+--------------------+----------- p28
// | +--------+
// GND
@donghee
donghee / gist:3978969
Created October 30, 2012 08:26
read temperature and save eeprom
#include "mbed.h"
int Tmp102_Read();
int EEPROM_Write();
int EEPROM_Read();
I2C i2c(p28, p27); // sda, scl
DigitalOut wp(p29);
char temp_1;
@donghee
donghee / gist:4086327
Created November 16, 2012 10:41
Rhino Python: divide points
import rhinoscriptsyntax as rs
def DivideSlab(srf, divisions):
u_domain = rs.SurfaceDomain(srf, 0)
v_domain = rs.SurfaceDomain(srf, 1)
for i in range(divisions+1):
u = u_domain[0] + (u_domain[1]-u_domain[0])*i/divisions
for j in range(divisions+1):
v = v_domain[0] + (v_domain[1]-v_domain[0])*j/divisions
point = rs.EvaluateSurface(srf,u,v)
@donghee
donghee / gist:4086719
Created November 16, 2012 11:53
Rhino Python: hexa spatial
import rhinoscriptsyntax as rs
crv = rs.GetObjects("Select curves in order")
att_pt1 = rs.GetObject("Select attractor pt 1")
#att_pt2 = rs.GetObject("Select attractor pt 2")
#CREATE LOFTED SURFACE FROM CURVES
#(Curves should be of same degree and to be selected IN ORDER)
srf = rs.AddLoftSrf(crv)
@donghee
donghee / gist:4086835
Created November 16, 2012 12:14
Rhino Python: hexa spatial 1
import rhinoscriptsyntax as rs
crv = rs.GetObjects("Select curves in order")
#CREATE LOFTED SURFACE FROM CURVES
#(Curves should be of same degree and to be selected IN ORDER)
srf = rs.AddLoftSrf(crv)
ud=rs.SurfaceDomain(srf,0)
vd=rs.SurfaceDomain(srf,1)
@donghee
donghee / gist:4135340
Created November 23, 2012 12:09
Rhino Python: Vector field
import rhinoscriptsyntax as rs
# This script will compute a bunch of cross-product vector based on a pointcloud
def AddVector(vecdir, base_point=[0,0,0]):
tip_point = rs.PointAdd(base_point, vecdir)
line = rs.AddLine(base_point, tip_point)
if line: return rs.CurveArrows(line, 2)
def vectorfield():
cloud_id = rs.GetObject("Input pointcloud", 2, True, True)