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 http = require('http'); | |
var sleep = require('sleep'); | |
var timeout = 100000; //sleep 100 seconds | |
http.createServer(function (req, res) { | |
setTimeout((function() { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end("Hello I am awake"); | |
}), timeout); | |
}).listen(8080); |
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
/** | |
This implementation simulates very very slow HTTP server | |
**/ | |
var http = require('http'); | |
var sleep = require('sleep'); | |
var fs = require('fs'); | |
var timeout = 1000; //sleep 1 seconds | |
var iteration = 100; //sleep 100 iteration | |
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
<? | |
// simple mongoclient dumpper | |
$a=getMongo(); | |
$b=getMongo(); | |
var_dump($a->getConnectionss()); | |
print("===================================SECOND MONGO CONN REQUEST ===================================\n"); | |
var_dump($b->getConnectionss()); | |
function getMongo(){//{{{ |
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
#you need git bash completion package for using __git_ps1 | |
export PS1='\n\[\e[32;1m\](\[\e[37;1m\]\u@\h\[\e[32;1m\])-(\[\e[37;1m\]jobs:\j\[\e[32;1m\])-(\[\e[0;32m\]\w)\[\e[34;1m\]-(LE:$?)-\[\e[37;1m\](\t)-$(__git_ps1 " \[\033[1;32m\](%s)\[\033[0m\]")\n->\[\e[0m\] ' | |
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
<html> | |
<head> | |
<meta name="twitter:card" content="product"> | |
<meta name="twitter:site" content="@leozc"> | |
<meta name="twitter:creator" content="@leozc"> | |
<meta name="twitter:title" content="Cool Car"> | |
<meta name="twitter:description" content="Cool Car and Green!"> | |
<meta name="twitter:image:src" content="http://www.teslamotors.com/tesla_theme/images/modelx/falcon_frames/full40.jpg"> | |
<meta name="twitter:data1" content="$180000"> | |
<meta name="twitter:label1" content="Price"> |
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
Verifying that +leozc is my Bitcoin username. You can send me #bitcoin here: https://onename.io/leozc |
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
#Example | |
scala -cp ~/.ivy2//cache/org.scalatest/scalatest_2.10/jars/scalatest_2.10-2.1.5.jar | |
scala> import org.scalatest._ | |
scala> Seq(1,2,3) must contain (1) | |
scala> Seq(1,2,3) must contain (5) | |
org.scalatest.exceptions.TestFailedException: List(1, 2, 3) did not contain element 5 | |
at org.scalatest.MatchersHelper$.newTestFailedException(MatchersHelper.scala:160) | |
at org.scalatest.MustMatchers$MustMethodHelper$.mustMatcher(MustMatchers.scala:6141) | |
at org.scalatest.MustMatchers$AnyMustWrapper.must(MustMatchers.scala:6187) |
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
fun1<- function(x) x*log(x,2) | |
fun2<- function(x) log(x,2) | |
fun3<- function(x) x | |
fun4<- function(x) x^2 | |
fun5<- function(x) x | |
x<-seq(0,50) | |
matplot(x,cbind(fun1(x),fun2(x),fun3(x),fun4(x),fun5(x)),type="l",col=c("blue","red","pink","green","black")) |
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
from collections import defaultdict | |
class Solution: | |
#top down | |
def minimumTotal(self, triangle): | |
if not triangle: | |
return None | |
minCost = [] # [ [(int,[elems)]]], [[cost1,[path2cost1]],[(cost2,[path2cost2])... | |
minCost.append([(triangle[0][0], [triangle[0][0]])]) # add first level | |
for rowId in range(1, len(triangle)): |
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
from subprocess import call | |
import subprocess | |
import json | |
import time | |
repeat = 30 | |
print '{\"result\":['# header | |
for x in range(repeat): | |
p = subprocess.Popen(["curl", 'http://localhost/php_fpm_status?json&full'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
OlderNewer