Skip to content

Instantly share code, notes, and snippets.

View lululau's full-sized avatar
🎯
Focusing

FCP lululau

🎯
Focusing
  • Sunshine, Mountain East
View GitHub Profile
@lululau
lululau / window-max.sh
Last active August 29, 2015 14:12
Script to maximize windows of pre-selected applications on OS X
#!/bin/bash
######################################################################################################
# Add names of applications which you want to maximize to ~/.windowmaxrc, each application name in a single line, for example:
#
# -> cat ~/.windowmaxrc
# iTerm
# Safari
# Google Chrome
# MacDown
@lululau
lululau / .icrt.yaml
Created December 25, 2014 14:50
Let shells in each pane of each tab of each window of iTerm2 to start in a pre-configured cwd and execute commands
w0t0p2:
dir: "~"
commands:
- pry
w0t1p0:
dir: "~/a/"
w0t1p1:
dir: "~/a/"
w0t1p2:
dir: "~/b/"
#!/bin/bash
if [ 0 = $# ]
then
lein repl
else
lein_home=$(brew info leiningen | sed -n 3p | cut -d' ' -f1)
clojure_jar_file_name=$(ls ${lein_home}/libexec)
clojure_jar_file_path="$lein_home/libexec/$clojure_jar_file_name"
java -cp "$clojure_jar_file_path" clojure.main "$@"
import Foundation
struct Point {
var x: Int = 200
var y: Int! = 2
var z: Int? = nil
}
class CPoint {
@lululau
lululau / html_heading_parser.rb
Created March 26, 2015 02:56
A ruby class to extract h1/h2/h3/... headings from HTML
#!/usr/bin/env ruby
class HTMLHeadingParser
class TreeNode
attr_accessor :content, :children, :parent, :level
def initialize(content, parent=nil)
@content = content
@children = []
@lululau
lululau / yt-info.sh
Last active August 29, 2015 14:19
Print accountings info for your VPNCloud account
#!/bin/bash
hostname='www.ttincloud.com'
session_name=www_ttincloud_com
function sign_in() {
echo "Session timeout, now re-sign-in."
echo -n "Username: "
read username
perl -i.bak -pe 's#<string>./dashAlfredWorkflow#<string>echo '\''tell application "System Events"\n tell process "Dash"\n tell first window\n tell first group\n set most_left_btn to first button\n set most_left_frame to value of attribute "AXFrame" of most_left_btn\n set most_left to first item of most_left_frame\n repeat with btn in buttons\n set frame to value of attribute "AXFrame" of btn\n set lft to first item of frame\n if lft &lt; most_left then\n set most_left_btn to btn\n set most_left to lft\n end if\n end repeat\n tell most_left_btn\n perform action "AXPress"\n end tell\n end tell\n end tell\n end tell\nend tell'\'' | osascript &amp;&gt; /dev/null;\n./dashAlfredWorkflow#' info.plist
tell application "System Events"
tell process "Dash"
tell first window
tell first group
set most_left_btn to first button
set most_left_frame to value of attribute "AXFrame" of most_left_btn
set most_left to first item of most_left_frame
repeat with btn in buttons
set frame to value of attribute "AXFrame" of btn
set lft to first item of frame
@lululau
lululau / goto-edges-of-text-objects.vim
Created April 29, 2015 16:52
goto-edges-of-text-objects.vim
function! GotoBeginningOf(type, ...)
normal `[
if a:type == "line"
normal ^
endif
endfunction
function! GotoEndOf(type, ...)
normal `]
if a:type == "line"
map <c-c> <esc>