Skip to content

Instantly share code, notes, and snippets.

View happydeveloper's full-sized avatar
🎯
Focusing

DU RU KANG happydeveloper

🎯
Focusing
  • duru
  • seoul, korea
View GitHub Profile
@happydeveloper
happydeveloper / freenx-userdata
Created September 1, 2011 01:48 — forked from smoser/freenx-userdata
userdata script for setting up freenx-server on ubuntu ec2
#!/bin/sh
# us-east-1 ami-42916c2b canonical ebs/ubuntu-natty-daily-i386-desktop-20110327
# ec2-run-instances --instance-type t1.micro --user-data-file /home/smoser/t/nx-setup.ud ami-42916c2b
{
set -x
iusername="nxtest"
ipasswd="foo.bar-NX"
lp_auth="smoser" # auth the user '${lp_auth}' to 'ubuntu' with ssh-import-id
[ -z "${lp_auth}" ] || sudo -Hu ubuntu ssh-import-id ${lp_auth}
@happydeveloper
happydeveloper / gist:1226357
Created September 19, 2011 11:53 — forked from rillflow/gist:1226334
JavaScript closure stack
function insertClosureStack(obj, name, variable) {
var old = obj[name];
obj[name] = function (n) {
if ( typeof n == 'number' ) { // 인자가 있는 경우 검색 시작
if ( variable == n ) { // 클로저 꼭대기 환경변수 variable 값과 주어진 인자를 비교
console.log('found ' + variable); // 맞으면 출력
} else { // 아니면
if ( typeof old == 'function' ) { // 직전 환경을 갖고있는 클로저(function)가 정의되어 있는지 확인 후
old(n); // 있으면 호출하며 양파껍질 하나를 벗김
@happydeveloper
happydeveloper / memoryUsage.cs
Created October 10, 2013 11:33
원도우 계열 운영체제 - 닷넷이 설치되어 있는 컴퓨터 닷넷 2.0 동작 메모리 사용량 체크
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;
namespace memoryUsage
{
class Program
@happydeveloper
happydeveloper / HelloRunnable.java
Created October 10, 2013 13:50
Runnable 객체는 Thread 생성자에게 넘겨준다. The Runnable object is passed to the Thread constructor API 참조 http://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html
package docs.oracle.com.Thread;
public class HelloRunnable implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("Hello from a thread!");
}
/**
@happydeveloper
happydeveloper / convertDateTimeToUnixTimestamp.sh
Last active December 25, 2015 05:49
#우리말 : 시간포맷을 일반시간형태에서 유닉스값으로 변경하는 법 #Convert date time string is in the following format
#Convert date time string is in the following format 06/12/2012 07:21:22. How can I conver it to UNIX timestamp?
#우리말 : 시간포맷을 일반시간형태에서 유닉스값으로 변경하는 법
#What you're looking for is date --date='06/12/2012 07:21:22' +"%s".
#당신으 찾는 날짜는 셀에서 다음과 같이 실행하면 됨
date --date='06/12/2012 07:21:22' +"%s"
#$ date --date='11/10/2013 07:21:22' +"%s"
#결과값 : 1384068082
#reference
#df – displays disk usage information based on file system (ie: entire drives, attached media, etc )
#The -h flag is for ‘human readable form’ meaning return results in the familiar megabyte/gigabyte format. You should see #something like this:
df -h
#du – displays disk usage information for each file and directory (ie: home directories, folders, etc )
du -sh ~
du -sh *
@happydeveloper
happydeveloper / array.php
Last active December 25, 2015 08:09
php배열 선언과 출력
<?php
/**
* Created by JetBrains PhpStorm.
* User: kangnaru
* Date: 13. 10. 12.
* Time: 오전 10:14
* To change this template use File | Settings | File Templates.
*/
$arr = array(1, 3, 6, 9);
print_r($arr);
@happydeveloper
happydeveloper / array_push.php
Last active August 19, 2019 08:50
php 배열 객체 array_push() 함수 사용법
<?php
/**
* Created by JetBrains PhpStorm.
* User: kangnaru
* Date: 13. 10. 12.
* Time: 오전 10:18
* To change this template use File | Settings | File Templates.
*/
$arr = array(1, 3, 9, 2);
array_push($arr,10);
@happydeveloper
happydeveloper / array_access.php
Created October 12, 2013 03:58
배열 접근 예제
<?php
/**
* Created by JetBrains PhpStorm.
* User: kangnaru
* Date: 13. 10. 12.
* Time: 오후 12:56
* To change this template use File | Settings | File Templates.
*/
$arr = array("foo"=>"bar", 12 => true);
echo $arr["foo"];
@happydeveloper
happydeveloper / array_muiti_demensional.php
Created October 12, 2013 04:26
다중배열의 선언과 접근
<?php
/**
* Created by JetBrains PhpStorm.
* User: kangnaru
* Date: 13. 10. 12.
* Time: 오후 1:21
* To change this template use File | Settings | File Templates.
*/
//http://php.net/manual/en/language.types.array.php