Skip to content

Instantly share code, notes, and snippets.

@koseki
koseki / jp-prefectures.html
Last active September 24, 2024 07:45
Japanese Prefectures 日本の都道府県 Text, JS, HTML 漢字, ローマ字, 都道府県コード
<select>
<option value="1">Hokkaido</option>
<option value="2">Aomori</option>
<option value="3">Iwate</option>
<option value="4">Miyagi</option>
<option value="5">Akita</option>
<option value="6">Yamagata</option>
<option value="7">Fukushima</option>
<option value="8">Ibaraki</option>
<option value="9">Tochigi</option>
@emergent
emergent / mechanize_with_proxy_and_basicauth.rb
Created October 30, 2012 23:47
Using mechanize with proxy and basic auth
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
agent.set_proxy('proxy.example.com', 80, 'username', 'password')
agent.add_auth('http://hoge.com','b_username','b_password')
agent.user_agent_alias = "Windows Mozilla"
res = agent.get('http://hoge.com/some/page')
puts res.body
@tsu-nera
tsu-nera / .zshrc
Created May 25, 2013 12:55
.zshrcのとりあえず記録用
###############
# zsh Setting
###############
###############
# ヒストリ関連
###############
# 履歴の保存先
HISTFILE=$HOME/.zsh-history
## メモリに展開する履歴の数
@komasaru
komasaru / google_geocode.rb
Last active July 11, 2019 02:15
Ruby script to get a address or latitude, longitude with Google Geocoding API.
#*********************************************
# 住所から緯度・経度を取得する、又は、
# 緯度・経度から住所を取得する。
# ( by Google Geocode API )
#*********************************************
#
require 'json'
require 'net/http'
BASE_URL = "http://maps.googleapis.com/maps/api/geocode/json"
@kidach1
kidach1 / file0.txt
Created November 18, 2013 01:43
Railsを触る際知っていると便利なRubyの基礎 [ブロックとかシンボルとか] ref: http://qiita.com/kidachi_/items/46a6e49b6306655ccd64
#配列要素の分割
> "foo bar bazz".split
=> ["foo", "bar", "bazz"]
#配列要素の指定文字列での分割
> "fooxbarxxxxbazz".split('x')
=> ["foo", "bar", "", "", "", "bazz"]
#配列要素の順番入れ替え
@JamieMason
JamieMason / unfollow.js.md
Last active June 29, 2026 05:20
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

By @foldleft.bsky.social, see also Unfollow everyone on bsky.app.

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
@voluntas
voluntas / shiguredo_recruit.rst
Last active May 4, 2026 16:55
時雨堂を支える採用
@jonobr1
jonobr1 / auto-capture.scpt
Last active September 6, 2024 19:20
A small AppleScript to take a screenshot every 30 seconds for 8 hours. Saves to an Image Sequence in a desktop folder. Great for recording your workday.
set dFolder to "~/Desktop/screencapture/"
do shell script ("mkdir -p " & dFolder)
set i to 0
repeat 960 times
do shell script ("screencapture " & dFolder & "frame-" & i & ".png")
delay 30 -- Wait for 30 seconds.
set i to i + 1
end repeat
@apolloclark
apolloclark / postgres cheatsheet.md
Last active August 19, 2026 09:35
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@CrossEye
CrossEye / permutations.js
Last active October 23, 2018 04:26
Find permutations of a list of (distinct) values. Uses Ramda
const R = require('ramda');
const permutations = (tokens, subperms = [[]]) =>
R.isEmpty(tokens) ?
subperms :
R.addIndex(R.chain)((token, idx) => permutations(
R.remove(idx, 1, tokens),
R.map(R.append(token), subperms)
), tokens);