Skip to content

Instantly share code, notes, and snippets.

View duyleekun's full-sized avatar
🎯
Focusing

Le Duc Duy duyleekun

🎯
Focusing
View GitHub Profile
@duyleekun
duyleekun / main.php
Created January 12, 2014 05:50
Get first sound of korean in PHP
<?php
function _uniord($c) {
if (ord($c{0}) >=0 && ord($c{0}) <= 127)
return ord($c{0});
if (ord($c{0}) >= 192 && ord($c{0}) <= 223)
return (ord($c{0})-192)*64 + (ord($c{1})-128);
if (ord($c{0}) >= 224 && ord($c{0}) <= 239)
return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
if (ord($c{0}) >= 240 && ord($c{0}) <= 247)
return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
@duyleekun
duyleekun / rakeroutes
Last active August 29, 2015 14:03
rake routes bug?
Prefix Verb URI Pattern Controller#Action
report POST /report(.:format) reports#create
new_report GET /report/new(.:format) reports#new
GET /report(.:format) reports#show
addRouteToEnv({
name: 'login_main_homepage',
path: /^\/login(?:\.([^\/.?]+))?$/,
host: {},
reqs: {
'action': 'login',
'controller': 'main/homepages',
'parts': ['format']
},
replace: function (opts) {
function FindProxyForURL(url, host) {
return "SOCKS 192.168.0.110:8889";
}
@duyleekun
duyleekun / KeyboardSupport.m
Last active October 20, 2020 06:54
UIKeyboardHID to XK X11 Key Sym
//
// KeyboardSupport.m
//
// Created by Diego Waxemberg on 8/25/18.
// Copyright © 2018 Moonlight Game Streaming Project. All rights reserved.
// Modified by Duy to use X11 symcodes used in guacamole and VNC
//
#import <UIKit/UIKit.h>
#import "KeyboardSupport.h"
@duyleekun
duyleekun / build.sh
Last active October 23, 2020 11:01
postgres cube test
# To increase the limit of CUBE_MAX_DIM DIMM
# Run inside docker
export PG_VER=13.0
apt-get install -y unzip gcc make zlib1g-dev libreadline-dev postgresql-server-dev-${PG_VER%.*} bison flex wget
wget https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.bz2 --quiet -O postgresql.tar.bz2
tar xvf postgresql.tar.bz2
cd postgresql-${PG_VER}
./configure
cd contrib/cube

Install R

brew install R openssl@1.1 libgit2

Inside R console run

Sys.setenv(PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig")