2017-05-01ãã1ã¶æéã®è¨äºä¸è¦§
ruby ã§ã¹ã¯ãªãããå®è¡ããã®ã¯èª°ï¼ ã¹ã¯ãªããã®å®è¡ã¦ã¼ã¶ã¼ãç¥ããããroot以å¤ã§åããããã¨ãã¼ããã·ã§ã³ããã¨ã§é¢åãªã®ã§ãroot 以å¤ãèµ·åãããã¨ããã¨æå¦ãããã£ã¦ãã¨ããããã¨ããããã§ã å®è¡ã¦ã¼ã¶ã¼IDãç¥ãã«ã¯ Process.euid #=>â¦
pbcopy ã³ãã³ãã¯ã¯ãªãããã¼ãã®ã³ãã¼ãåºæ¥ã¦ä¾¿å©ã pbcopy ã³ãã³ãã使ãã¨ãã¿ã¼ããã«ã®åºåå 容ãã³ãã¼ãåºæ¥ãã便å©ãªã³ãã³ã ã§ãå°ã£ããã¨ãæããã¯ãªãããã¼ãã«ã³ãã¼ãããå 容ãè¦ããªãã takuya@~$ ls / Applications Network Userâ¦
QuickLookãã©ã°ã¤ã³ã使ã Quicklookã¯ãªãã¨å°ãåå¨ã§ã使ãå§ããã¨ãããããªãã¡ã¤ã«ããã¬ãã¥ã¼ããããªãã ã¤ã³ã¹ãã¼ã«ã»ã¤ã³ã¹ãã¼ã«æ¸ã¿ã®ãã©ã°ã¤ã³ã¯ããã§è¦³ããã ã¤ã³ã¹ãã¼ã«ããã«ã¯ããã®ãã©ã«ãã«çªã£è¾¼ãã°ããã /Users/takuya/Libâ¦
ããï¼java ã©ãã«å ¥ããã£ã java æ¬ä½ãã³ãã³ã ãªãã¦ãã£ãã«ä½¿ããªãã®ã§ãã¤ãã¤ãæ²¹æãã¾ãããã java_home ã¨ãã便å©ãªã³ãã³ããæãã /usr/libexec/java_home Debian ã«ã¯ã³ãã³ããè¦å½ãããªãã£ãã®ã§ãã¶ããMacOSç¨ã ã¨æãã®ã§ããã調â¦
Xpath ã便å©ãªã®ããã HTMLããã¼ãã«ã§ <a> ãçã£ã¦åãåºãããã¨ãã«ãè¤æ°åãåºãã¡ãããnth-child ã使ãã°è¯ããã ãããã©ãXpathã®æ¹ããããããæè»ã«æ¸ããã®ã§ä¾¿å©ãªãã§ãããã <ul> <li><a></a> <li><a></a> <li><span><a></a></span> <li> <ul> ããã ã¨ãï¼åãã® a ãçãã®ã¯ //li[2]/a ã«ãªããã </ul></li></li></li></li></ul></a>â¦
ã¡ãã£ã¨åä½èª¿ã¹ãã®ã« main æ¸ãã®ããã©ãããã java ã REPL ã¤ã¾ãã対話åã¤ã³ã¿ã¼ãã§ã¤ã¹ã§CLIã§å®è¡ãããã go ã node ã§ãä¸è©±ã«ãªããããswhift ã«ããæè¼ããã¦ãphp ã«ããæè¼ããã¦ããã. ruby ãªã pry / irb ã python ãªã ipython â¦
curl ã§ãã¡ã¤ã«ã次ã ã¨åå¾ãã¦ã¦ curl ã§ããã±ã¼ã¸ãåå¾ãããã転éããããã¦ã¦ä»ã®ä½æ¥ã«æ¯éãã§ããã¨ãããã¾ãã curl ä¸è½ãªã®ã§ä½¿ãããã¾ãã speed limit ãã¤ãããã¨ã§ curl ãé度å¶éåºæ¥ã¾ãã é度ä¸éãã¤ãããã¨ã§ãç©ããã«ãæ¥ãâ¦
ãã°ãgrep ãã¦ãªã¢ã«ã¿ã¤ã 確èªãã確å®ãªæ¹æ³ï¼tailf/tail -f ã¨çµã¿åãã
tailf ã®çµæãgrep ãã¦xargs ãããå ´å grep ããã ããªãåé¡ãªããããã¯æå¾ ã©ããã«åã tail -f a.log | grep name grep ã pipeã®éã«å ¥ãã¨åä»ã tail -f a.log | grep name | grep type ãã®å ´åã¯æ£ããåä½ããªããä¸éã«æã¾ã£ãgrepãIOããâ¦
ãã¡ã¤ã³ç»é²ãããã¨ãã¦ã¦ããµã¨è¦ããã»ã»ã» ããï¼èªè¨¼é£æºã¢ã«ã¦ã³ããAmazonï¼ï¼ï¼ï¼ ããããã¦Amazonã£ã¦OAuthã®é£æºãã§ããã®ã§ã¯ãªããï¼ ãããã¢ã«ã¦ã³ãé£æºã§ãããªãå¼·ã ã ã£ã¦ã¯ã¬ã«ç»é²çé«ããããã·ã§ããã³ã°ãµã¤ãã§ä½¿ããªã絶対ã«å¼·â¦
script ã³ãã³ãã§ä½æ¥å 容ããªã¢ã¼ãã§ä¼ãã screen ã³ãã³ãã®å ±æã§ãåºæ¥ããã©ããscript ã³ãã³ãã ãã§ãåºæ¥ãããã screen ã®å ±æã¨ãã¨åãã§ãã è¦ãããå´ã§ script -f -a sample.log ã¿ããå´ã§ tail -F sample.log ã¨ãã¦ããã°ãã£ã¨è¦ã¦â¦
mycli ã便å©ã§ãã°ã SELECT / INSERT ãªã©ãè£å®ãã¦ããã¦ããã¼ãã«åãã«ã©ã åãè£å®ãã¦ããã¦ãSQLãè²ä»ããã¦ãããã ã¤ã³ã¹ãã¼ã« python ã§åºæ¥ã¦ãã®ã§pip ã§ã¤ã³ã¹ãã¼ã« pip install mycli pip ããªãã¨ã㯠pyenv ã pyenv ããæºåããã°â¦
pyenv ãã¤ã³ã¹ãã¼ã«ããã python 3.6 ã使ããããªã¨æã£ã¦ã¤ã³ã¹ãã¼ã«ãã¯ããã¾ããã ã¦ã¼ã¶ã¼ç©ºéã«virtualenv ä½ããã楽ã¡ãã ã pyenv 使ããã ã¤ã³ã¹ãã¼ã« git clone git://github.com/yyuu/pyenv.git ~/.pyenv macOS ãªã²ã¨ã¯ brew install pâ¦
ãã®ãã¤ã¼ãã©ãã ã£ãï¼ ãã¼ãã® retweet ãããã¤ä½å¦ã ã£ã ãã®ã¨ãã«Tweetãããã¤ãªãã ãã© ãªã©ã¨éå»ã®ãªãã¤ã¼ãããã¤ã¼ããæ¤ç´¢ããããã¨ãå¤ã æãã¾ãããã æ¤ç´¢æ¹æ³ãæãã¾ãã å¼ç¨å ãã¨ãã°èªåã®éå»ã®ãã¤ã¼ããRTå«ãã¦æãåºãâ¦
åæã«ï¼ã¤ã®ãã°ãè¦ãã tail -f ãï¼ã¤èµ·åãã¦ãã¿ã¼ããã«ä¸¦ã¹ã¦ããã®ãéªéãããã¨æã£ã¦ã¾ããã tail -f /path/to/log2 /path/to/log1 ããããã°ãè¤æ°ã®ãã°ãã¡ã¤ã«ãåæã« tail ã§ã¦ãªããã§ããã ãã¾ã¾ã§ã¯ watch 㨠cat ãçµåãã¦ãã®ã§â¦
tail -f ã³ãã³ãã使ãã¨ãã¡ã¤ã«ã®åé¤ã§åä½ãæ¢ã¾ãã tail -f /path/to/log 㧠ãã°ãã¡ã¤ã«ãè¦ã¦ããã¨ãã«ãå¥ã®ããã»ã¹ã§ãã¡ã¤ã«ãæ¶ããã ãã¡ã¤ã«ãæ¶ããããåä½ãæ¢ã¾ãã mv /path/to/log /dev/null rm /path/to/log echo hello > /path/tâ¦
pid ãæå®ãã㨠tail ã³ãã³ããèªåçã«çµäºãã tail -f --pid=$PID /path/to/log PIDãæå®ããã¨ãã« ãã¼ã«ã«ãã¹ãéçºãã¼ã«ã®ãã°ç£è¦ãã¦ãã¨ãã¨ãã«ä¾¿å©ã§ããã man tail --pid=PID with -f, terminate after process ID, PID dies åèè³æ hâ¦
chrome ã® dev tools ã«åºã¦ããé¢æ° $ 㨠$$ ã®éã $ = document.querySelector $$ = document.querySelectorAll $x 㯠Xpath $x('//a') xpath ã¯çµã¿ç«ã¦ã¨å¼ã³åºããé¢åãªã®ã§ãã¨ã¦ãå¬ããã ãã®ä»ã®é¢æ°ãããã¡ã¦ãã㨠ã¯ã¨ãªç³» $ $$ $x ç´åã®ãâ¦
å³ã¯ãªãã¯ã§Evernoteã«ãã¡ã¤ã«ãéããã Finderã§å³ã¯ãªãã¯ã§ãã¡ã¤ã«ãEvernoteã«éãã«ã¯ã©ããããã ããã®ã¢ããªã±ã¼ã·ã§ã³ã§éããâãEvernoteãã¨ããã°ããããé ç®ã«Evernoteããªããã°ããã®ä»ããé¸ã¹ã°ãããã®ã§ããããã æåããç¨æãâ¦
Evernoteã«ãã¡ã¤ã«ãã¾ã¨ãã¦æ¾ãè¾¼ã¿ããã ã³ãã³ãã§ã¾ã¨ãã¦Evernoteã«æ¾ãè¾¼ã¿ãããAPIãçµç±ããã¨æ¯å¹´ããã¼ãæ´æ°ããªãã¡ããããªãã®ã§é¢åããã ãªã®ã§ãApple Script ( ã® JavaScript ) ã§ãããã¨æã ( Windows ãªäººã¯åãç®ç㧠enscript.â¦
JXA 㧠NSString ã使ã£ã¦PATHã®å¤æããã¦ã¿ãã®ã§ã¡ã¢ objcã®Cocoa ãã NSString 㨠FileManager ã使ã£ãã®ã§ãããããç¥è¦ãå¾ãããã®ã§ã¡ã¢ã Javascriptã§ãNSString ã使ãã«ã¯ã次ã®ããã«ããã ObjC.import('Cocoa') NSStringã init ã㦠alloâ¦
Selenium 㧠ãã©ã¼ã éä¿¡ ããã«ã¯ã è¥å¹²ã®Waitãå ¥ãã¦ãããã¨ãã¾ãåãã¨æãã driver.goto 'https://example.com/login' wait = Selenium::WebDriver::Wait.new(:timeout => 3) # second ## ãã¼ã¸ãã¼ããå¾ ã¤ wait.until { driver.xpath('//*[@id=â¦
selenium 使ããã¨ãããã¨ã©ã¼ã«ãªã£ãã >> require 'selenium-webdriver' => true >> driver = Selenium::WebDriver.for :chrome , :desired_capabilities => caps NameError: undefined local variable or method `caps' for main:Object from (pry):2:iâ¦
ãã°ãã¡ã¤ã«ãç£è¦ãã¦ãslack ãªã©ã«éç¥ãããã ãã°ãç£è¦ã㦠Slackã«æããæ¹æ³ã§ããããããªã®ãèããã ãã°ãã¡ã¤ã«ã«ä½ãå¤æ´ããã£ã¦ããããç¹å®ã®ã¨ãã« ã¡ã¼ã«ã slack ã®ãã£ã³ãã«ã«éç¥ãåºããã便å©ã ã¨æãã ãããããã°ç£è¦ãéç¥â¦
Google Chrome ããã¹ã¯ã¼ããå©ç¨ããã¦ãããªã Chromeã«Googleã¢ã«ã¦ã³ãã§ãã°ã¤ã³ãã¦ãå ´åããã®ã¢ã«ã¦ã³ãã®ãã¹ã¯ã¼ãã¯è£å®ãããªãã ãã®ããã«ãChromeã§ãã¹ã¯ã¼ããä½åº¦ãå ¥åãããã¨ã«ãªãé¢åãããã åå ã¨çç± ã¡ãã£ã¨å®é¨ãã¦ã¿ãã â¦
prime numbers ( ç´ æ° ) ã«å解ãã¦ãããã³ãã³ãããã£ãã takuya@Desktop$ factor 123456 123456: 2 2 2 2 2 2 3 643 factor ã¨ã¯ è¦å ã®æå³ã§æ°å¦çã«å æ°ã§ãfactor ã³ãã³ãã¯ ç´ æ°ã使ã£ã¦å æ°ã表ç¾ãã¦ãããã³ãã³ã ä½ã«ä½¿ãã®ãã ç¹ã«ä½ã«ä½¿â¦
æ¹è¡ã³ã¼ããåå ã§ã¨ã©ã¼ã«ãªãã æ¹è¡ã³ã¼ãã \r\n ãåå ã§ã¨ã©ã¼ã«ãªã£ãã takuya@:~$ bash -n apt apt: è¡ 2: äºæããªããã¼ã¯ã³ `$'\r'' å¨è¾ºã«æ§æã¨ã©ã¼ãããã¾ã 'pt: è¡ 2: `_apt() ä¸ç¬ä½ã®ã¨ã©ã¼ãããããªãã£ããã©ããè¦ãã¨ã¨ã©ã¼ã«æ¹è¡â¦