Skip to content

Instantly share code, notes, and snippets.

tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
tell application "System Events"
click checkbox 1 of tab group 1 of window 1 of application process "System Preferences"
end tell
end tell
if application "System Preferences" is running then
tell application "System Preferences" to quit
end if
func! ViewResource()
let f = input("Filename: ", expand("<cfile>:p"))
let f2=substitute(f, "/", "\\", "g")
" windows system.
" using irfanview
call system('"C:/Program Files/IrfanView/i_view32.exe" '.f2)
endfunc
" To use, save this file and type ":so %"
" Optional: First enter ":let g:rgb_fg=1" to highlight foreground only.
" Restore normal highlighting by typing ":e"
setlocal nohlsearch
d search('^" BEGIN_COLOR_LIST', 'e')
while search('\w\+') > 0
let w = expand('<cword>')
if w == 'END_COLOR_LIST'
break
endif
" Color test: Save this file, then enter ':so %'
" Then enter one of following commands:
" :VimColorTest "(for console/terminal Vim)
" :GvimColorTest "(for GUI gvim)
function! VimColorTest(outfile, fgend, bgend)
let result = []
for fg in range(a:fgend)
for bg in range(a:bgend)
let kw = printf('%-7s', printf('c_%d_%d', fg, bg))
let h = printf('hi %s ctermfg=%d ctermbg=%d', kw, fg, bg)
@sooop
sooop / swift_basic_operaters.swift
Created August 19, 2014 06:56
Swift Basic Operators
infix operator + {
associativity left
precedence 140
}
infix operator ... {
associativity none
precedence 135
}
@sooop
sooop / qsort.py
Created October 20, 2014 02:42
Quick Sort in functional programming style
def qsort(alist):
if len(alist) == 0:
return []
pivot = alist[0]
less = filter(lambda x: x < pivot, alist[1:])
greater = filter(lambda x: x >= pivot, alist[1:])
return qsort(less) + [pivot] + qsort(greater)
a = [45, 53, 26, 93, 62, 20, 33, 17]
@sooop
sooop / sort_algorithm.swift
Created October 22, 2014 05:30
swift로 구현해본 기본 정렬 알고리듬
// Bubble Sort
func bubbleSort<T:Comparable>(inout l:[T]) {
if l.count == 0 { return }
var changed = true
while changed {
changed = false
for i in 1..<l.count {
if l[i] < l[i-1] {
@sooop
sooop / Combinations.py
Last active August 29, 2015 14:09
순열/조합을 구하는 함수
def combinations(iterable, r):
# combinations('ABCD', 2) -> AB AC AD BC BD CD
pool = tuple(iterable)
n = len(pool)
if r > n:
return
indices = range(r)
yield tuple(pool[i] for i in indices)
while True:
for i in reversed(range(r)):
@sooop
sooop / bubble_sort.c
Last active August 29, 2015 14:14
C로 구현한 여러 정렬 함수
#include "sort.h"
/**
* sort array by using bubble sort
* @param void* base: array's pointer
* @param int n: number of elements in array
* @param int size: size of value type
* @param int(*cmp)(const void*, const void*): compare function
* cmp(a, b) : returns 1 if a > b, 0 if a == b, 0 otherwise.
*/
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any