Skip to content

Instantly share code, notes, and snippets.

View vaibhavsagar's full-sized avatar
🕺
🪩

Vaibhav Sagar vaibhavsagar

🕺
🪩
View GitHub Profile
@esmooov
esmooov / checkout.md
Created May 31, 2012 15:54
The Secret Passions of Git Checkout

The Secret Passions of Git Checkout


The Hand of God

Master Hand

Git checkout can do almost anything ... or, at least, many things. It can switch branches. It can mix and match branches. It can resolve merge conflicts. It can give you a scratchpad to test things. It can even be used to interactively patch files. It's so powerful because it's so abstract. But much like numinous mystics, abstraction makes it confusing.

Basically git checkout does two things:

@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@Profpatsch
Profpatsch / jq
Last active August 17, 2017 03:30
jq replacement (‽)
#!/usr/bin/env bash
if [[ -z "$1" ]]; then
echo "No filter given, abort"
exit 1
fi
tmp=$(mktemp -d)
jq="$tmp/jq"
@aaronlevin
aaronlevin / minimal-http.hs
Last active June 27, 2017 16:37
Minimal Haskell HTTP server written on top of warp via the Web Application Interface (no frameworks)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai (pathInfo, Request, requestMethod, Response, responseLBS, ResponseReceived)
import Network.Wai.Handler.Warp (run)
import Network.HTTP.Types (status200, status401)
-- note: type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
application :: Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
@chrisdone
chrisdone / FieldTH.hs
Last active February 13, 2017 22:17
$(lens 'foo) -- handy one-off lens maker for record fields
{-# LANGUAGE TemplateHaskell #-}
-- | For when you have a record that doesn't have lenses derived for
-- it and you need a lens, just use @$(lens 'thefield)@ and away you go.
module Control.Lens.FieldTH where
import Language.Haskell.TH
lens :: Name -> Q Exp
lens name = do
[|\f r ->
fmap
$(lamE
@ndmitchell
ndmitchell / policies.md
Created June 12, 2017 20:55
Friendly contribution policies

This is intended as a reply to https://ro-che.info/articles/2017-06-12-friendly-contributing-policies, but I don't really want it to be a blog post (it's not the right level for my blog), and that blog doesn't have comments, and I don't want to mis-express myself in 120 characters or whatever. So here goes a gist :)

Firstly, as to the talk, the context was read around the project, and figure out if it will suit you. I am deliberately quoting haskell-src-exts out of context, and deliberately not saying where either quote came from. I appreciate the full policy is much more welcoming than that one snippet would imply.

However, when I wanted to find an unfriendly contributing policy, I immediately thought of haskell-src-exts. I do genuinely find the document, as a whole, quite unwelcoming. I appreciate that languages sound different to native speakers, and it didn't stop me contributing, but it did give me pause. Whether a document is friendly or not is a feeling, and so by explaining why I have that feeling

@thoughtpolice
thoughtpolice / RegAlloc1.hs
Last active July 26, 2022 13:49
Simple register allocation, see "Essentials of Compilation" for more https://jeapostrophe.github.io/courses/2017/spring/406/notes/book.pdf
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PartialTypeSignatures #-}
module RegAlloc1
( -- * Types
Var

The original code (~7.2s on my laptop).

import System.Random
import System.CPUTime

rainfall :: [Int] -> Int
rainfall xs = sum (zipWith (-) mins xs)
@frasertweedale
frasertweedale / Newton.hs
Last active March 2, 2019 14:59
Newton's method (Haskell)
{-# LANGUAGE RankNTypes #-}
import Numeric.Natural (Natural)
import Numeric.AD (diff)
newtonRoot
:: (Floating a, Ord a)
=> Natural -- ^ iterations
-> a -- ^ epsilon
-> a -- ^ starting guess
@EdOverflow
EdOverflow / github_bugbountyhunting.md
Last active April 29, 2024 14:36
My tips for finding security issues in GitHub projects.

GitHub for Bug Bounty Hunters

GitHub repositories can disclose all sorts of potentially valuable information for bug bounty hunters. The targets do not always have to be open source for there to be issues. Organization members and their open source projects can sometimes accidentally expose information that could be used against the target company. in this article I will give you a brief overview that should help you get started targeting GitHub repositories for vulnerabilities and for general recon.

Mass Cloning

You can just do your research on github.com, but I would suggest cloning all the target's repositories so that you can run your tests locally. I would highly recommend @mazen160's GitHubCloner. Just run the script and you should be good to go.

$ python githubcloner.py --org organization -o /tmp/output