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
| #!/bin/sh | |
| # Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
| set -e | |
| NAME=ip_monster | |
| PIDFILE=/var/run/$NAME.pid | |
| LOG="/var/log/$NAME.log" | |
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
| ; 2013-11-29 SOLVED | |
| (defn p53-longest-increasing-sub-seq [s] | |
| (let [begin-sequences | |
| (fn [s] (rest (reductions (fn [a b] (conj a b)) [] s))) | |
| end-sequences | |
| (fn [s] (reverse (reduce (fn [mem a] (conj (map (fn [b] (flatten [b a])) mem) (list a))) [] s))) | |
| longest | |
| (fn [s] (reduce (fn [longest x] (if (> (count x) (count longest)) x longest)) [] s))] | |
| (->> (apply concat (map begin-sequences (end-sequences s))) | |
| (filter (fn [s] (apply < s))) |
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
| #!/bin/sh | |
| # step 1 - compile perl {{{ | |
| /root/perl5/perlbrew/perls/perl-5.16.3/bin/perl /root/p/bin/perlbrew install perl-5.18.1 --notest -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Dpager=/usr/bin/sensible-pager -Doptimize=-O2 -Duseshrplib -Dcf_by=Dave [email protected] -Duse64bitall -Darchname=x86_64-linux-gnu -Dccflags=-DDEBIAN | |
| # }}} | |
| # step 2 - install cpan modules with newly compiled perl {{{ | |
| PERL5=/root/perl5/perlbrew/perls/perl-5.18.1 |
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
| insert-statement = (table, obj) -> | |
| columns = keys obj | |
| value-set = [ "$#{i+1}" for k,i in columns ].join ', ' | |
| vals = values obj | |
| return ["INSERT INTO #table (#columns) VALUES (#value-set) RETURNING *", vals] | |
| update-statement = (table, obj, wh) -> | |
| wh ?= "WHERE id = $1" | |
| ks = keys obj |> filter (-> it isnt \id) | |
| obj-vals = [ obj[k] for k in ks ] |
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
| <br /> | |
| <b>Notice</b>: Undefined index: session_userid in <b>/Users/beppu/src/github.com/asg/top.php</b> on line <b>29</b><br /> | |
| <br /> | |
| <b>Notice</b>: Undefined index: id in <b>/Users/beppu/src/github.com/asg/top.php</b> on line <b>38</b><br /> | |
| <br /> | |
| <b>Notice</b>: Undefined index: current_document in <b>/Users/beppu/src/github.com/asg/top.php</b> on line <b>39</b><br /> | |
| <br /> | |
| <b>Notice</b>: Undefined index: javascript_doc_id in <b>/Users/beppu/src/github.com/asg/top.php</b> on line <b>65</b><br /> | |
| <br /> | |
| <b>Notice</b>: Undefined index: session_accessLevel in <b>/Users/beppu/src/github.com/asg/top.php</b> on line <b>70</b><br /> |
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 perl | |
| use strict; | |
| use warnings; | |
| use LWP::Simple; | |
| use URI; | |
| use URI::QueryParam; | |
| use URI::Escape; | |
| while(<>) { | |
| my ($url, $title) = split(/\|/); |
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 perl | |
| use common::sense; | |
| use AnyEvent; | |
| use Coro; | |
| use AnyEvent::HTTP::LWP::UserAgent; | |
| use SOAP::Lite; # +trace => 'all'; | |
| use SOAP::Transport::HTTP; # preload it so that we can set USERAGENT_CLASS reliably; | |
| my @results; |
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
| [node@metanotes ~]$ perl -M5.10.0 -e 'say join("\n", split(":", $ENV{PATH}))' | xargs ls > path.txt | |
| /home/node/local/bin: | |
| npm | |
| [email protected] | |
| /home/node/local/nodejs/bin: | |
| node | |
| node_g | |
| node-repl | |
| node-waf |
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
| mysql> select * from purchase_item where purchase_id = 2; | |
| +----+-------------+-----+---------+------------+-------------+-------+---------------------+---------------------+ | |
| | id | purchase_id | day | t | child_name | child_grade | price | created_on | modified_on | | |
| +----+-------------+-----+---------+------------+-------------+-------+---------------------+---------------------+ | |
| | 37 | 2 | 0 | regular | Bill | 0 | 5.00 | 2011-01-13 13:08:56 | 2011-01-13 15:08:56 | | |
| | 38 | 2 | 0 | regular | Bill | 0 | 5.00 | 2011-01-13 13:08:56 | 2011-01-13 15:08:56 | | |
| | 39 | 2 | 0 | regular | Bill | 0 | 5.00 | 2011-01-13 13:08:56 | 2011-01-13 15:08:56 | | |
| | 40 | 2 | 0 | regular | Bill | 0 | 5.00 | 2011-01-13 13:08:56 | 2011-01-13 15:08:56 | | |
| | 41 | 2 | 0 | regular | Bill | 0 | 5.00 | 2011-01-13 13:08:56 | 2011-01-13 15:08:56 | | |
| | 42 | 2 | 0 | regula |
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/perl | |
| use strict; | |
| use warnings; | |
| my $country = shift; | |
| die("Usage: block <COUNTRY>\n") unless $country; | |
| # Examples: | |
| # block Russia < GeoIPCountryWhois.csv > deny_russia.list | |
| # block Poland < GeoIPCountryWhois.csv > deny_poland.list | |
| # |