Skip to content

Instantly share code, notes, and snippets.

View zchee's full-sized avatar
😩
want to Go knowledge...

Koichi Shiraishi zchee

😩
want to Go knowledge...
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@rcrowley
rcrowley / rxvt-unicode.sh
Created June 15, 2010 06:39
Mac rxvt-unicode setup.
# Mac rxvt-unicode setup.
# http://rcrowley.org/articles/rxvt-unicode.html
# Install dependencies from MacPorts and CPAN.
sudo port install rxvt-unicode +xterm_colors_256
sudo port install terminus-font
sudo cpan install Mac::Pasteboard
# Run urxvt at X11 startup.
defaults write org.x.X11 app_to_run /opt/local/bin/urxvt
@kch
kch / plist-to-yaml.rb
Created August 4, 2010 09:54
converts plist files to really pretty, aligned yaml files with mostly literal utf8 strings
#!/usr/local/bin/ruby
# encoding: UTF-8
require 'yaml'
require "base64"
require 'rexml/document'
class PList < BasicObject
ELEMENT_PROCESSORS = {}
def self.process_element_named(name, &block); ELEMENT_PROCESSORS[name.to_s] = block; end
def self.process_element(elt) ; ELEMENT_PROCESSORS[elt.name][elt]; end
@putermancer
putermancer / bzr2git.py
Created October 13, 2010 21:18
Migrate a bzr repo (with history) to git
#!/usr/bin/env python
import os, shutil, subprocess, time
from optparse import OptionParser
USAGE = """%prog [options] name
Converts a bzr repository into a git repository and preps it for git-flow"""
def run(*cmds):
output = []
@bobthecow
bobthecow / tab.bash
Last active November 10, 2023 08:47
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@xavierd
xavierd / complete.cc
Created December 29, 2010 15:20
Hacking with libclang completion.
#include <clang-c/Index.h>
#include <cstdlib>
#include <iostream>
/*
* Compile with:
* g++ complete.cc -o complete -lclang -L/usr/lib/llvm
* Run with:
* LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...]
*/
@pvdb
pvdb / list_targets.sh
Last active November 8, 2023 08:18
List all targets (sometimes incorrectly referred to as "goals") in a GNU Makefile
#
# this gist can be used to list all targets, or - more correctly - rules,
# that are defined in a Makefile (and possibly other included Makefiles)
# and is inspired by Jack Kelly's reply to a StackOverflow question:
#
# http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make/3632592#3632592
#
# I also found this script - http://www.shelldorado.com/scripts/cmds/targets - which does
# something similar using awk, but it extracts targets from the "static" rules from a single
# Makefile, meaning it ignores any included Makefiles, as well as targets from "dynamic" rules
@bobpp
bobpp / com.github.mxcl.homebrew.daemontools.plist
Created February 13, 2011 06:47
daemontools at Mac OS X homebrew
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.mxcl.homebrew.daemontools</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/svscanboot</string>
</array>
@demonbane
demonbane / makeapp.sh
Created July 5, 2011 20:05
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
@andyfowler
andyfowler / .vimrc
Created September 5, 2011 18:08
Swap iTerm2 cursors in vim insert mode when using tmux
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif