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/perl | |
use strict; | |
use warnings; | |
use File::Find; | |
use v5.10; | |
my @dir = qw(/Path/To_Your_Dir/); | |
my $buser = 'Legal_User_Name'; | |
my @danger; |
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 ytdl = require('ytdl') | |
function stream(req,res,id) { | |
var dl = ytdl('http://www.youtube.com/watch?v='+id, { | |
quality:43 //poor quality leave empty for good quality | |
}) | |
dl.pipe(res); | |
} |
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
{- | |
Handwritten packrat parser for trivial integer arithmetic expressions. Guarantees O(n) time/space complexity. | |
Rule: Exp <- IntVal / (Exp) / (+ Exp Exp) / (- Exp Exp) / (* Exp Exp) | |
Examples: " 233 ", "( + 42 ((233) ) )", "( (* 42 (+ 1 233)) )". | |
Properly handles whitespaces. "2 33" will not be recognized as 233. | |
-} | |
import Data.Char | |
data Node = Nil | Node {next::Node,char::Char,skipped::Node,result::Result} |
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 Data.Char | |
newtype Parser a = Parser (String -> [(a,String)]) | |
parse :: Parser a -> String -> ([(a,String)]) | |
parse (Parser p) inp = p inp | |
instance Monad Parser where | |
return val = Parser (\inp -> [(val,inp)]) | |
pa >>= f = Parser (\inp -> |
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
$ go build setuid.go | |
$ sudo su | |
[sudo] password for bore: | |
# chown root:root setuid | |
# chmod u+s setuid | |
$ ./setuid | |
Real UID: 1000 | |
Effective UID: 0 | |
Real UID: 1000 | |
Effective UID: 1000 |
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
package dockertest | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"net" | |
"os" | |
"os/exec" | |
"strings" |
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 Prelude | |
import System.Environment | |
import Network.HTTP | |
import Control.Monad | |
showUsage :: IO () | |
showUsage = do | |
putStrLn "Usage: stock <options...>\n" | |
putStrLn " - get a quote: stock <symbol>" | |
putStrLn " - change money: stock <from> <to> <amount>" |
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
package db | |
import ( | |
"database/sql" | |
"log" | |
"strings" | |
"sync" | |
_ "github.com/lib/pq" // required for database/sql | |
"golang.org/x/net/context" |
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 monit config goes in /etc/monit/conf.d | |
check process puma_master | |
with pidfile /data/myapp/current/tmp/puma.pid | |
start program = "/etc/monit/scripts/puma start" | |
stop program = "/etc/monit/scripts/puma stop" | |
group myapp | |
check process puma_worker_0 | |
with pidfile /data/myapp/current/tmp/puma_worker_0.pid |
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
See question on stack overflow: http://stackoverflow.com/questions/28595636/rails-4-how-to-give-alias-names-to-includes-and-joins-in-active-record-que | |
- Model Student and model Teacher are both STI models with super class model User | |
- Model Story is a STI model with super class model Task | |
- includes() and joins(), both fails | |
Rails alias naming convention (includes() and joins()) | |
- One model as parameter | |
- is base model (includes(:users)) |
OlderNewer