This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "objspace" | |
| def memsize(model) | |
| model.all.inject(0) { |s, record| s + record.instance_variables.sum { |iv| ObjectSpace.memsize_of(record.instance_variable_get(iv)) } } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pullするときにrebaseする | |
| git config --global pull.rebase true | |
| # mergeするときにfast-forwardせずにマージコミットを作る | |
| git config --global merge.ff false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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>limit.maxfiles</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>launchctl</string> | |
| <string>limit</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl -w | |
| use strict; | |
| $SIG{"CHLD"} = sub { exit; }; | |
| my $pid = fork(); | |
| if ($pid) { | |
| foreach my $sig (qw(TERM INT QUIT)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| pid = fork do | |
| exec "long long command" | |
| end | |
| %i(TERM QUIT INT).each do |sig| | |
| trap(sig) do | |
| Process.kill(sig, pid) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <key>NSAppTransportSecurity</key> | |
| <dict> | |
| <key>NSExceptionDomains</key> | |
| <dict> | |
| <key>xip.io</key> | |
| <dict> | |
| <key>NSIncludesSubdomains</key> | |
| <true/> | |
| <key>NSExceptionAllowsInsecureHTTPLoads</key> | |
| <true/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task :iterm do | |
| ItermWindow.open do | |
| release_roles(:all).each do |host| | |
| hostname = host.hostname | |
| open_tab "opened_by_iterm_window" do | |
| write "ssh #{hostname}" | |
| end | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ffmpeg -i infile.mkv -acodec aac -ab 256k -vn outfile.m4a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # デフォルトで1秒間隔 | |
| interval=${1:-1} | |
| vmstat $interval | awk '{print strftime("%y/%m/%d %H:%M:%S"), $0} {fflush() }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| TABLE_SCHEMA, | |
| TABLE_NAME, | |
| PARTITION_NAME, | |
| TABLE_ROWS, | |
| CEIL(DATA_LENGTH / 1024 / 1024) AS DATA_LENGTH_MiB, | |
| CEIL(INDEX_LENGTH / 1024 / 1024) AS INDEX_LENGTH_MiB, | |
| CEIL((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS TOTAL_LENGTH_MiB | |
| FROM | |
| INFORMATION_SCHEMA.PARTITIONS |