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
@sooop
sooop / compile_sass.py
Last active March 8, 2017 08:07
Markdown to PDF (python3 + PhantomJS)
#!c:/python34/python.exe
import sass
import sys
def main(scss_filename, css_filename=None):
if css_filename is None:
css_filename = scss_filename.rsplit('.', 1)[0] + '.css'
with open(scss_filename, 'rb') as f:
d = f.read()
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 / gist:8dc424e13c6fe2e2a663
Last active April 18, 2024 04:40
Steve Losh's VIMRC
" .vimrc
" Author: Steve Losh <[email protected]>
" Source: http://bitbucket.org/sjl/dotfiles/src/tip/vim/
"
" This file changes a lot. I'll try to document pieces of it whenever I have
" a few minutes to kill.
" Preamble ---------------------------------------------------------------- {{{
" Dear /bin/bash: fuck you and your bullshit, arcane command-line behaviour.
@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 / Monads.swift
Last active February 3, 2020 16:20
Monad in Swift : 모나드 개념을 Swift로 구현해본다.
/*
모나드는 특정한 타입을 감싸는 타입이며,
raw한 값을 감싸는 함수와
raw한 값을 모나드 값으로 바꾸는 어떤 함수에 바인딩된다.
이를 바탕으로 모나드 프로토콜을 정의하면 다음과 같다.
*/
protocol Monad {
@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] {