Skip to content

Instantly share code, notes, and snippets.

@suya55
suya55 / .gitconfig
Last active April 4, 2018 09:47
git config alias
[core]
autocrlf = input
editor = /usr/bin/vim
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[alias]
@suya55
suya55 / ij.sh
Last active June 21, 2017 14:28
Open a project in IntelliJ IDEA from your command line! Raw
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# Setup your working directory. Edit 'work' to your working directory.
working_dir=`ls -1d ~/work/$1 | head -n1`
# were we given a directory?
if [ -d "$1" ]; then
@suya55
suya55 / [cron] 파일 생성 날짜를 기준으로 마지막 10개의 파일만 유지 하는 크론
Last active September 1, 2017 06:25
[cron] 파일 생성 날짜를 기준으로 마지막 10개의 파일만 유지 하는 크론
0 1 * * * rm -rf `ls /path/* -t | awk 'NR>10'`
또는
0 1 * * * ls -1dt /path/* | tail -n +11 | xargs rm -rf
@suya55
suya55 / -
Created April 25, 2016 10:22
루프백 다운시키는 명령어
/sbin/ifdown lo:0
@suya55
suya55 / grant.sql
Created April 25, 2016 10:25
Mysql grant user
grant all privileges on *.* to ‘develop'@'localhost';
Update mysql.user SET Password = Password('pwd') where User = 'develop';
flush privileges;
@suya55
suya55 / cpu_core_check.sh
Created April 26, 2016 07:36
cpu 코어 갯수 확인
grep ^processor /proc/cpuinfo | wc -l
@suya55
suya55 / listen_port_check.sh
Created April 27, 2016 04:49
netstat check listen port
sudo netstat -plnt

@suya55
suya55 / biggest_files.sh
Created May 19, 2016 05:58
display 10 biggest open files
lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB "$9 }' | sort -n -u | tail
@suya55
suya55 / active_record.rb
Created January 20, 2017 10:03
create_on_duplicate_key_update
module ActiveRecord
# = Active Record Persistence
module Persistence
extend ActiveSupport::Concern
def create_on_duplicate_key_update!(keys)
#keys = duplicate_keys.is_a? Array ? duplicate_keys : [duplicate_keys] #TODO: 배열이 아닐때? 코드짜기.
keys.collect! { |k| k.to_s }
klass = self.class
attributes_with_values = arel_attributes_with_values_for_create(attribute_names)
@suya55
suya55 / application.conf
Created November 3, 2017 06:25
wsClient 설정 참고.
# Configuratino for Play ws
play.ws {
timeout {
# If non null, the connection timeout, this is how long to wait for a TCP connection to be made
connection = 10 seconds
# If non null, the idle timeout, this is how long to wait for any IO activity from the remote host
# while making a request
idle = 10 seconds
# If non null, the request timeout, this is the maximum amount of time to wait for the whole request
request = 10 seconds