Skip to content

Instantly share code, notes, and snippets.

@moein9
moein9 / h1_team_usernames.json
Created July 2, 2022 09:45
Hackerone triager usernames 2/7/2022
[
"1k3rnelpan1c",
"1nfinit3",
"antiquark",
"apus-apus",
"aseal",
"azolotov_eh9xx",
"b3ach",
"b67f994ced21e2f1d7c5434",
"bassguitar",
@baweaver
baweaver / block_transform_ast.rb
Last active August 3, 2023 22:53
Pattern matching applied to ASTs, defining the transformation between shorthand and standard block format.
require "rubocop"
# Useful for debugging and seeing how the nodes deconstruct
def deep_deconstruct(node)
return node unless node.respond_to?(:deconstruct)
node.deconstruct.map { deep_deconstruct(_1) }
end
def block_to_shorthand?(a, b)
@barsa-net
barsa-net / Dockerfile
Last active February 29, 2024 16:14
wagoodman/dive image builder for ARM64/aarch64
FROM golang:alpine AS builder
RUN apk update && \
apk add git make
WORKDIR /go/src
ARG DIVE_VERSION=${DIVE_VERSION:-v0.10.0}
RUN git clone https://github.com/wagoodman/dive.git dive && \
git -C /go/src/dive checkout ${DIVE_VERSION}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
import sys
class Memoize:
def __init__(self, fn):
self.fn = fn
self.memo = {}
def __call__(self, arg):
if arg not in self.memo:
self.memo[arg] = self.fn(arg)
@junefrench
junefrench / RE_GEX.md
Last active August 29, 2015 14:19
Writeup of RE GEX challenge from PlaidCTF 2015

REG EX

Writeup

This is a writeup of the reversing challenge 'REG EX' from PlaidCTF 2015.

The challenge provided two files: a python server program and a crazy-huge regex (see regex.txt). The python server is very basic: it simply listens for a connection, prompts for a 'key', and then checks whether the key matches the regex. It will then send the flag, but only if the provided key did NOT match the regex.

After the initial shock of looking at many screenfulls of regex, it actually breaks down into simple chunks. The regex consists of a single group which must match the entire string (^(...)$), containing a number of alternatives. Because we need to find a string which does not match the regex, we need to ensure that none of the alternatives match our string. The first alternative (.*[^plaidctf].*) will match any string which contains any character not in 'plaidctf', so we know our solution will contain only those characters. The second two alternatives (.{,170}|.{172,}) will match any string

@tel
tel / ParserCombinators.hs
Created November 3, 2014 19:54
Monad transformers and parser combinators
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module ParserCombinators where
{-
We'll build a set of parser combinators from scratch demonstrating how
they arise as a monad transformer stack. Actually, how they arise as a
choice between two different monad transformer stacks!
@plesner
plesner / polyenum.hs
Last active February 9, 2017 02:55
Polynomial range function in haskell
-- Given a list of values, returns a list of the differences between
-- neighbouring pairs of values.
nextLevelDiffs (a:b:rest) = (b - a):(nextLevelDiffs (b:rest))
nextLevelDiffs _ = []
-- Given a list of values, returns a list of the differences such that the
-- first element is the 0-level differences, the second the 1-level and so
-- on.
nLevelDiffs [] = []
nLevelDiffs elms = elms:(nLevelDiffs (nextLevelDiffs elms))
anonymous
anonymous / gist:10675250
Created April 14, 2014 19:11
Motion Blur + Chromatic Aberration
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
@mattt
mattt / UTTypeForImageData.m
Created March 27, 2014 23:19
A quick function for determining an image's file type by its first couple of bytes
@import MobileCoreServices;
static CFStringRef UTTypeForImageData(NSData *data) {
const unsigned char * bytes = [data bytes];
if (data.length >= 8) {
if (bytes[0] == 0x89 && bytes[1] == 0x50 && bytes[2] == 0x4E && bytes[3] == 0x47 && bytes[4] == 0x0D && bytes[5] == 0x0A && bytes[6] == 0x1A && bytes[7] == 0x0A) {
return kUTTypePNG;
}
}