Skip to content

Instantly share code, notes, and snippets.

View daeyun's full-sized avatar

Daeyun Shin daeyun

View GitHub Profile

Keybase proof

I hereby claim:

  • I am daeyun on github.
  • I am daeyun (https://keybase.io/daeyun) on keybase.
  • I have a public key whose fingerprint is 6553 BCFF 61B1 C9C3 8656 6941 C801 E60D B9BF 5E6A

To claim this, I am signing this object:

@daeyun
daeyun / default.nix
Created July 21, 2017 20:04
Dev sandbox
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "env";
env = buildEnv { name = name; paths = buildInputs;};
buildInputs = [
opencv3
c-blosc
eigen
assimp
google-gflags
@daeyun
daeyun / pca.py
Created February 15, 2016 11:33
computing principal components and singular values
import numpy as np
import numpy.linalg as la
np.random.seed(42)
X = np.random.randn(100, 5)
assert la.matrix_rank(X) == 5
def pca_svd(X):
public class Main {
public static void main(String[] args) throws IOException {
SocketChannel socketChannel = SocketChannel.open();
try {
socketChannel.connect(new InetSocketAddress("localhost", 10100));
} catch (IOException e) {
// Connection error
}
@daeyun
daeyun / boggle.cpp
Last active December 27, 2015 21:49
C++ Boggle solver. Perform BSF on a graph of 26 vertices.
/* Author: Daeyun Shin */
#include<map>
#include<cassert>
#include<queue>
using namespace std;
map<char, map<char, bool> > graph;
int boggle(int board[4][4], const char * word) {
// populate the graph
for (int i = 0; i < 4; i++) {
@daeyun
daeyun / longestPalindromeLength.py
Last active December 23, 2015 02:29
find the length of the longest palindrome subsequence in O(n^2)
#!/usr/bin/python
class LongestPalindrome:
def longestPalindrome(self, string):
self.string = string
self.LP = {}
return self.longestPalindrome_(0, len(self.string) - 1)
def longestPalindrome_(self, i, j):
if (i, j) in self.LP:
return self.LP[(i, j)]
@daeyun
daeyun / lisBigger.py
Created September 15, 2013 00:16
length of longest increasing subsequence
#!/usr/bin/python
def lisBigger(prev, A):
if len(A) == 0:
return 0
max = lisBigger(prev, A[1:])
if A[0] > prev:
L = 1 + lisBigger(A[0], A[1:])
if L > max:
max = L
return max
# check if s is a subsquence of S
def checkSubsequence(s, S):
idx = 0
for char in s:
if idx >= len(S):
return False
while char != S[idx]:
idx += 1
if idx >= len(S):
return False
@daeyun
daeyun / s3-jekyll-sync.md
Last active December 11, 2015 19:18
managing a jekyll site on s3/cloudfront

testing

jekyll --server 8080 --auto

publishing

jekyll build

s3cmd sync _site/ s3://www.daeyunshin.com --add-header 'Cache-Control: max-age=300' --delete-removed --reduced-redundancy --acl-public --cf-invalidate

@daeyun
daeyun / x86_note_1.md
Last active December 11, 2015 19:09
random x86 note

If you see this error when compiling a 32 bit x86 assembly code with the -m32 flag on a 64 bit environment, install gcc-multilib.

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status