Skip to content

Instantly share code, notes, and snippets.

@mad-p
mad-p / macsetup.md
Last active July 23, 2019 08:21
新しいMacBook Proへ乗りかえるために行った作業

新しいMacBook Proへ乗りかえるために行った作業

  • 再インストール
    • Command + Rを押しながら起動してリカバリーモードに
    • SIPをdisable:
      • ターミナルを開く: csrutil disable
    • Machintosh HDを消去
      • 消去オプションで作成するファイルシステムを「APFS 大文字/小文字区別、暗号化」
      • ディスクパスワードを設定
  • MacOSを再インストール
@mad-p
mad-p / resolve_repos.rb
Created July 22, 2019 02:30
Find suitable git clone for repositories
#!/usr/bin/env ruby
# Find suitable git clone for repositories
# Usage: ruby resolve_repos.rb | sh -x
dirs = Dir.glob("*")
dirs.each do |dir|
next unless File.directory?(dir)
git_remote = `cd #{dir}; git remote -v 2>&1 | egrep '\\(fetch\\)$|^fatal'`
@mad-p
mad-p / macos-java-thread-dump.txt
Created December 27, 2018 04:38
Zalenium thread dump
2018-11-28T07:37:33.079232700Z 2018-11-28 08:37:33
2018-11-28T07:37:33.079305500Z Full thread dump OpenJDK 64-Bit Server VM (25.181-b13 mixed mode):
2018-11-28T07:37:33.079357300Z
2018-11-28T07:37:33.079372400Z "jersey-client-async-executor-2" #190 prio=5 os_prio=0 tid=0x00007f26904a5000 nid=0x194 waiting on condition [0x00007f2640db4000]
2018-11-28T07:37:33.079386300Z java.lang.Thread.State: TIMED_WAITING (parking)
2018-11-28T07:37:33.082691500Z at sun.misc.Unsafe.park(Native Method)
2018-11-28T07:37:33.082747300Z - parking to wait for <0x00000000e21defd8> (a java.util.concurrent.SynchronousQueue$TransferStack)
2018-11-28T07:37:33.082767300Z at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
2018-11-28T07:37:33.082785500Z at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)
2018-11-28T07:37:33.082803400Z at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
@mad-p
mad-p / IETF103.md
Created November 29, 2018 05:30
idcon mini #4

IETF103 Token Binding関連の論点

tokbind WG

@mad-p
mad-p / answer.txt
Last active August 29, 2015 14:01
CodeIQ 863 TicketGobble Problem
62 Afghanistan Angola Anguilla Antarctica Austria Azerbaijan Bangladesh Barbados Belarus Belize Botswana Burundi Canada Chad China Cyprus Denmark Ecuador Egypt Eritrea Ethiopia Fiji Finland Germany Ghana Greece Guadeloupe Guyana Jamaica Jersey Kiribati Kuwait Kyrgyzstan Libya Liechtenstein Macao Malawi Malaysia Maldives Martinique Montenegro Montserrat Namibia Narnia Nepal Nicaragua Niger Oman Poland Portugal Rwanda Samoa Seychelles Singapore Slovakia Slovenia Sudan Sweden Switzerland Tokelau Turkey Uganda
ENV: Ruby
POINT: 重複を消していけばよい
★解き方
以下のような形で日程の重なっているチケットを消していく
- 重複タイプ1: チケットの出発日から帰国日までの期間を完全に含む他のチケットがある
チケットA D----A D: 出発日、A: 帰国日
チケットB D------------A
@mad-p
mad-p / answer.txt
Last active December 25, 2015 00:09
平成変換を解いてみました #codeiq 2014から26に至る変換を見つけるという問題でした。 問題の解説はこちら http://antimon2.hatenablog.jp/entry/2013/08/07/231634
[2]014->[4]014->[16014]->(256)448196->1(64)4(81)(9)6->(1849)(36)->(4)(36)->26
(7ステップ)
別解
7: [2014]->4056[196]->40563(841)6->(4)0[5]63[2]96->(2025)6[3](49)6->(456976)->(676)->26
8: [201]4->(4)0[4]014->(201601)4->4[4][9][4]->4(1681)16->(441)16->(2116)->(4)6->26
8: 20[14]->20[19]6->[2]0[3]616->(4096)16->6[41]6->6(16)(81)6->6(49)6->(676)->26
言語: Ruby
@mad-p
mad-p / numdot1.hs
Created September 24, 2013 22:32
初めてのHaskell: CodeIQ 468 ナムドット問題
import Data.List
-- 分割psのi番目にdを追加する
append d ps i = let (l, rr) = splitAt i ps
m = head rr
r = tail rr
in l ++ [m ++ d] ++ r
-- 各分割にdを追加したもの、dを新規分割として加えたものを返す
add d ps = (map (append d ps) [0..length ps - 1]) ++ [ps ++ [d]]
@mad-p
mad-p / persistent.rb.diff
Created August 17, 2012 06:06
NO_PROXY auto-detection without http_configuration gem
--- bundler-1.1.5/lib/bundler/vendor/net/http/persistent.rb.orig 2012-08-17 15:02:50.000000000 +0900
+++ bundler-1.1.5/lib/bundler/vendor/net/http/persistent.rb 2012-08-17 15:01:17.000000000 +0900
@@ -163,6 +163,11 @@
else raise ArgumentError, 'proxy must be :ENV or a URI::HTTP'
end
+ @no_proxy = []
+ if proxy == :ENV
+ @no_proxy = (ENV['NO_PROXY'] || ENV['no_proxy'] || 'localhost, 127.0.0.1').split(/\s*,\s*/)
+ end
@mad-p
mad-p / anything-update-or-select-action.el
Created February 14, 2012 00:17
TAB to update anything candidates without delay
(defun anything-update-or-select-action ()
"Immediately update anything candidates without delay.
If invoked twice in a row, does anything-select-action"
(interactive)
(if (eq last-command 'anything-update-or-select-action)
(anything-select-action)
(anything-check-new-input (minibuffer-contents))))
(mapc #'(lambda (sym)
(let ((map (and (boundp sym) (symbol-value sym))))