Skip to content

Instantly share code, notes, and snippets.

View ujiro99's full-sized avatar

ujiro99 ujiro99

  • japan
View GitHub Profile
# 現在のユーザー名とホスト名をタイトルに
$global:currentuser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$user_and_host = ($currentuser.name -replace "(.*?)\\(.*?)$", "`$2@`$1")
$Host.UI.RawUI.WindowTitle = $user_and_host + " - Windows PowerShell"
# プロンプトのカスタマイズ
function prompt {
write-host ""
# ディレクトリの表示 (バックスラッシュをスラッシュに変換)
@markembling
markembling / gitutils.ps1
Last active March 29, 2023 01:47
Powershell functions for git information
# Git functions for PowerShell
# Copyright 2009-2019 Mark Embling (http://www.markembling.info/)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@markembling
markembling / profile.ps1
Created September 4, 2009 12:27
My preferred prompt for Powershell - includes git info.
# My preferred prompt for Powershell.
# Displays git branch and stats when inside a git repository.
# See http://gist.github.com/180853 for gitutils.ps1.
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1)
function prompt {
$path = ""
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::RemoveEmptyEntries)
if($pathbits.length -eq 1) {
@uasi
uasi / gist:214109
Last active September 11, 2015 03:06
Show branch name in Zsh's right prompt
#
# Show branch name in Zsh's right prompt
#
autoload -Uz VCS_INFO_get_data_git; VCS_INFO_get_data_git 2> /dev/null
setopt prompt_subst
function rprompt-git-current-branch {
local name st color gitdir action
@hagenburger
hagenburger / javascript_loader.js
Created July 30, 2010 15:28
Dynamically load JavaScript files with callback when finished
// Example:
JavaScript.load("/javascripts/something.js");
// With callback (that’s the good thing):
JavaScript.load("http://www.someawesomedomain.com/api.js", function() {
API.use(); // or whatever api.js provides ...
});
@rkumar
rkumar / itunes.sh
Created August 1, 2010 09:23
control iTunes from command line
#!/bin/bash
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
# edit 2010.06.01 rahul kumar
####################################
showHelp () {
@asserchiu
asserchiu / logcat-threadtime_to_csv.c
Created March 2, 2011 04:38
convert threadtime format logcat into csv file
#include <stdio.h>
#include <stdlib.h>
int main(int argv, char *argc[])
{
if (argv!=2)
{
printf("Usage: %s \"threadtime_format_logcat_file\"\n",__FILE__);
exit(-1);
}
@yoshikaw
yoshikaw / gist:862031
Created March 9, 2011 11:07
CygwinのscreenでコピーバッファをWindowsクリップボードに流し込むっ!
# changes the filename used for reading and writing with the paste buffer.
bufferfile 'screen/screen-exchange'
# copy the screen pastbuffer to the Cygwin pastebord
bindkey -m ' ' eval 'stuff \040' 'writebuf' 'exec sh -c "/usr/bin/putclip < screen/screen-exchange"'
bindkey -m Y eval 'stuff Y' 'writebuf' 'exec sh -c "/usr/bin/putclip < screen/screen-exchange"'
bindkey -m W eval 'stuff W' 'writebuf' 'exec sh -c "/usr/bin/putclip < screen/screen-exchange"'
@uasi
uasi / create-chrome-launcher.sh
Created March 23, 2011 05:31
Create an .app that launches Google Chrome with a specified profile
#!/bin/sh
#
# Create Google Chrome launcher (for Mac)
#
CHROME_APP="/Applications/Google Chrome.app"
CHROME_PROFILE_DIR="$HOME/Library/Application Support/Google/Chrome"
echo "Enter profile name: \c"
@azu
azu / _nya_git.lua
Created April 7, 2011 16:18
gitコマンドの補完、サブモジュールの削除nyaosスクリプト
-- nyaosのgit向けluaコマンド
-- print('loading... "_nya_git.lua"')
-- $git submodule rm
-- サブモジュールの削除
-- http://labs.timedia.co.jp/2011/03/git-removing-a-submodule.html
nyaos.command['git submodule rm'] = function(name)
local modulepath = nyaos.eval('git config --file .gitmodules --get submodule.' .. name .. '.path');
nyaos.exec('git rm --cached ' .. modulepath);
nyaos.exec('git config --file .gitmodules --remove-section submodule.' .. name);
nyaos.exec('git commit -m "Remove submodule '..name..'"')