sudo apt-get install golang git mercurial git clone https://github.com/hanwen/go-mtpfs.git cd go-mtpfs go build sudo mv go-mtpfs /usr/local/sbin/go-mtpfs sudo chmod a+x /usr/local/sbin/go-mtpfs sudo mkdir /media/mtp sudo chmod 775 /media/mtp sudo /usr/local/sbin/go-mtpfs -allow-other=true /media/mtp
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
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb``` | |
require 'rubygems' | |
require 'nokogiri' | |
require 'csv' | |
f = File.open("/tmp/preview.html") | |
doc = Nokogiri::HTML(f) | |
csv = CSV.open("/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => 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
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
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
d <- data.frame(PT=c(3,2,5,1)) | |
d <- data.frame(d, capacity=1/d$PT) | |
d$flow_rate <- min(d$capacity) # no demand numbers here | |
d <- data.frame(d, process_capacity=min(d$capacity)) | |
d <- data.frame(d, cycle_time=1/d$process_capacity) | |
d <- data.frame(d, dlc=sum(d$PT)) | |
d <- data.frame(d, idle_time=d$cycle_time-d$PT) | |
d <- data.frame(d, total_idle_time=sum(d$idle_time)) | |
d <- data.frame(d, total_labor_content=sum(d$PT)) | |
d <- data.frame(d, labor_util=d$total_labor_content/(d$total_labor_content+d$total_idle_time)) |
in1 <- c(TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE)
x[in1]```
* single [] operator returns the same class - except in matrix. To get the same behavior in matrix, set ``` drop=FALSE``` attribute
* ```x[1,,drop=FALSE] ```
* ```attributes(y) ``` to list all attributes of a data strucuture
* ``` attr(y, "class")``` to print out one particular attribute
* lists also work as hashes ```x <- list(foo = 1:4, bar=0.6) x$foo ```
- if CBV terminates, then so does CBN - since CBN will evaluate less than or equal parameters than CBV
- CBV avoids repeated recomputation of values
- force scala to do CBN, by defining
def fun(x:Int, y:=>Int)
- disjunction and conjunction (&& and ||) are short-circuit operators - the right side will only be evaluated in certain cases.
- in certain cases like
if(r==0) return 1
there is an errorScala: type mismatch; found : Unit required: Boolean
- this happens because you have to have an else clause, otherwise the type checker doesn't know what the return type is when it's not the case
return fn(a-1)
is tail recursive butreturn n * fn(a-1)
is not
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 'openssl' | |
c = OpenSSL::Cipher::Cipher.new("rc4-40") | |
serial = 4000987 | |
puts " *********** SERIAL NUMBER = #{serial}" | |
c.encrypt | |
c.key = "fdkjgfdoi4tu45fkgkljfg9485439tkjfgnjdshfghwhe54350gfgklkgje34324nkjdfhk45845843543k5kdjfk3454958439kkfkglgkttpoeoidsad49584305ldkfsdjf42jkndfl" | |
padded_serial = "%015d" % serial | |
padded_serial_array = [padded_serial.slice(0,10).to_i, padded_serial.slice(10,15).to_i] |
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
proxy_cache_path /var/lib/nginx/cache/staticfiles levels=1:2 keys_zone=staticfilecache:60m inactive=90m max_size=50m; | |
proxy_temp_path /var/lib/nginx/proxy; | |
proxy_connect_timeout 30; | |
proxy_read_timeout 120; | |
proxy_send_timeout 120; | |
map $http_cookie $logged_in { | |
default 0; | |
~wordpress_logged_in 1; # Wordpress session cookie |
locate /usr/java/tomcat/temp/hsperfdata_tomcat/
to get processid of tomcat jps -J-Djava.io.tmpdir=/usr/java/tomcat/temp
/usr/java/jdk1.6.0_24/bin/jmap -J-Djava.io.tmpdir=/usr/local/tomcat-instance/traduscms/temp -heap 23420
sudo -u root /usr/java/jdk1.6.0_24/bin/jstack -J-Djava.io.tmpdir=/usr/local/tomcat-instance/tradusgv/temp -J-d64 10960
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 bash | |
set -o errexit -o nounset -o pipefail | |
cd "$(mktemp --directory)" | |
git init | |
cat > test.txt <<EOF | |
alfa | |
bravo | |
charlie |