Skip to content

Instantly share code, notes, and snippets.

View likejazz's full-sized avatar

Sang Park likejazz

View GitHub Profile
find . -maxdepth 1 -type d -mtime +30 -exec echo {} \;
@likejazz
likejazz / .profile
Last active August 29, 2015 13:59
My .profile in Mac Os X
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# Tell `ls` to be colourful
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Tell `grep` to highlight matches
export GREP_OPTIONS='--color=auto'
for i in `seq 1 8`
do
echo "cat ~/.ssh/id_rsa.pub | ssh account@iaas-hh$i 'cat >> .ssh/authorized_keys'"
cat ~/.ssh/id_rsa.pub | ssh account@iaas-hh$i 'cat >> .ssh/authorized_keys'
done
#!/bin/bash
DAUMID=*****
DAUMPW=*****
# IMAP SSL/TLS
response=`{ echo "a001 login $DAUMID $DAUMPW"; sleep 1; echo "a002 select inbox"; sleep 1; echo "a003 logout"; } | /usr/local/bin/gnutls-cli imap.daum.net --port=993`
# fetch `UNSEEN` mail count
unseen=$(echo $response | grep -oEi 'OK\ \[UNSEEN\ (\d+)' | awk '{print $3}')
PLATFORM=`uname`
if [[ "$PLATFORM" == 'Darwin' ]]; then # Mac
IP=`/sbin/ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}'`
elif [[ "$PLATFORM" == 'Linux' ]]; then # Linux
IP=`/sbin/ifconfig eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'`
fi
print $IP
@likejazz
likejazz / MaxTemp.java
Created November 3, 2014 04:42
O'Reilly's "Hadoop: The Definitive Guide" ch2 sample in a one file
// cc MaxTemperature Application to find the maximum temperature in the weather dataset
// vv MaxTemperature
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
.vim
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
static int callback(void *NotUsed, int argc, char **argv, char **azColName) {
NotUsed = 0;
int i;
for (i = 0; i < argc; i++) {
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
#!/bin/bash
set -e
GIT_OPTS="--max-count=10"
commit_id_format=$(tput setaf 3)
date_format=$(tput setaf 4)
author_format=$(tput setaf 2)
ref_name_format=$(tput setaf 1)
#!/bin/sh
# See http://www.wtfpl.net/txt/copying for license details
# Creates a minimal manifest and manifest.uuid file so sqlite (and fossil) can build
git rev-parse --git-dir >/dev/null || exit 1
git log -1 --format=format:%ci%n | sed -e 's/ [-+].*$//;s/ /T/;s/^/D /' > manifest
echo $(git log -1 --format=format:%H) > manifest.uuid