This file contains 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
import scala.reflect.runtime.universe._ | |
//in A perfect world : without type erasure | |
implicit class SuperFuture (a : Future[Option[_]]){ | |
def or (b : Future[Option[_]]) ={ | |
a match { | |
case a1 : Future[Some[_]] => a1 | |
case _ => b | |
} | |
} |
This file contains 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
import scalaj.http.{HttpOptions, Http} | |
def YQL3(query: String) = { | |
val url = "http://query.yahooapis.com/v1/public/yql" | |
Future { | |
blocking { | |
Http(url).params("format" -> "xml", "q" -> query) | |
.option(HttpOptions.connTimeout(5000)) //Optional: yql can take a long time for response | |
.option(HttpOptions.readTimeout(10000)).asString |
This file contains 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
var fixKeys = function(obj) { | |
return Object.keys(obj).reduce(function(mem,key) { | |
if(Array.isArray(obj[key])){ | |
mem[key.trim()] = obj[key].map(function(v){return v.trim()}) | |
}else{ | |
if(typeof obj[key] === 'object'){ | |
mem[key.trim()] = fixKeys(obj[key]) | |
}else{ | |
mem[key.trim()] = (obj[key]).trim() | |
} |
This file contains 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
;;; -*- mode: emacs-lisp -*- | |
;;; This file is loaded by Spacemacs at startup. | |
;25.1.50.2 | |
;;; It must be stored in your home directory. | |
(defun blah() (dotspacemacs/user-config)) | |
;;(blah) | |
(defun dotspacemacs/user-config () | |
"This is were you can ultimately override default Spacemacs configuration. | |
This function is called at the very end of Spacemacs initialization." |
This file contains 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
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory |
This file contains 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
sudo ls -1d */ | sudo xargs -I{} du {} -sh && sudo du -sh |
This file contains 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
rsync -avP FROM TO | |
-u, --update skip files that are newer on the receiver |
This file contains 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
iotop -bktoqqq -d .5 | |
where: -b is batch mode | |
-k is kilobytes/s | |
-t adds timestamp | |
-o only show processes or threads actually doing I/O | |
-qqq removes output headers | |
-d .5 updates every .5 seconds | |
Once you have the process id, you can also find the files with |
This file contains 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/wget "www.example.com" --timeout 30 -O - 2>/dev/null | grep "Normal operation string" || echo "The site is down" | /usr/bin/mail -v -s "Site is down" your@e-mail.address |
This file contains 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
comment is | |
sed -i '/<pattern>/s/^/#/g' file | |
And to uncomment it: | |
sed -i '/<pattern>/s/^#//g' file | |
In your case: | |
sed -i '/2001/s/^/#/g' file (to comment out) | |
sed -i '/2001/s/^#//g' file (to uncomment) |