Skip to content

Instantly share code, notes, and snippets.

@snaka
snaka / hello.cpp
Created December 6, 2011 14:15
"Hello world" する LLVM assembly code を生成する C++ コード
#include <llvm/LLVMContext.h>
#include <llvm/Module.h>
#include <llvm/BasicBlock.h>
#include <llvm/CallingConv.h>
#include <llvm/Constants.h>
#include <llvm/Function.h>
#include <llvm/GlobalVariable.h>
#include <llvm/Instructions.h>
#include <llvm/PassManager.h>
#include <llvm/Analysis/Verifier.h>
@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@abesto
abesto / gist:3476594
Created August 26, 2012 09:27
Go: Newton's method for square root
/*
A Tour of Go: page 44
http://tour.golang.org/#44
Exercise: Loops and Functions
As a simple way to play with functions and loops, implement the square root function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating: z - (z*z - x) / (2 * z)
@dsummersl
dsummersl / makeFullScreen.applescript
Created November 30, 2012 12:19
Applescript script for toggling applications in and out of fullscreen mode.
on run argv
(*
Toggle an application from full screen to non full screen (or the reverse).
Parameters:
1: application name(ie, Chrome)
2: boolean (true/false).
When true ensure that the application is in full screen mode (if not, make it so)
When false ensure that the application is NOT in full screen mode (if not, make it so)
*)
set theapp to item 1 of argv
@rummelonp
rummelonp / zsh_completion.md
Last active February 22, 2023 15:06
zsh の補完関数の自作導入編

zsh の補完関数の自作導入編

あまり深く理解してないので識者のツッコミ大歓迎

補完を有効にする

取り敢えず最低限だけ

# 補完を有効にする
@kortschak
kortschak / mul.go
Created May 11, 2013 10:20
Example of how a Mul might look.
package matrix
import (
"github.com/gonum/blas"
)
var blasEngine blas.Float64
type Float64 struct {
mat BlasMatrix
@tonyc
tonyc / gist:5989308
Last active December 19, 2015 17:09
Ubuntu + chruby + ruby-2.0/passenger/nginx/redis stack
#/usr/bin/env bash
set -e
set -x
apt-get update
apt-get upgrade
apt-get -y install build-essential curl git-core openssl libreadline6 libreadline6-dev \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
@naosim
naosim / renameGitBranch.md
Last active December 20, 2023 12:09
ローカルとリモートのブランチ名を変更する

#ローカルとリモートのブランチ名を変更する

以下、ブランチ名を hoge から foo に変更する例

  • ローカルのブランチ名変更
git branch -m hoge foo
  • リモートのブランチを消す
@hyg
hyg / gist:9c4afcd91fe24316cbf0
Created June 19, 2014 09:36
open browser in golang
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@ktx2207
ktx2207 / Git_ファイルの履歴を完全に削除する.md
Last active February 17, 2024 05:32
Git ファイルの履歴を完全に削除する

Git ファイルの履歴を完全に削除する

秘密鍵など誤ってコミットしてしまった場合に履歴を完全に削除する手順
参考:6.4 Git のさまざまなツール - 歴史の書き換え

動作確認用にブランチを作成して試す

$ git checkout -b clean-key-file

動作確認用にブランチでgit filter-branchを実行