Skip to content

Instantly share code, notes, and snippets.

View bxt's full-sized avatar

Bernhard Häussner bxt

View GitHub Profile
@alexjercan
alexjercan / aoc2021-day06.ipynb
Created December 6, 2021 21:38
Aoc2021 day06 lanternfish got out of hand
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@smac89
smac89 / immutable-stack.scala
Last active May 4, 2021 18:28 — forked from lambda-hacker/immutable-stack.scala
Stack using List [Scala]
// Immutable Stack Type using List
case class Stack[A] (elems: Seq[A] = List.empty[A]) {
def push(v: A) : Stack[A] = Stack(v +: elems)
def pushAll(xs: Iterable[A]) : Stack[A] =
xs.foldLeft (this) ((accStack, e) => accStack.push(e))
def pop(): Either[String, (A, Stack[A])] = {
if (isEmpty) Left("Cannot pop from empty stack")
@cschell
cschell / last_game.rb
Last active February 11, 2019 19:19
This script queries the RIOT-API for the last game of a summoner
# Usage: ruby last_game.rb <summoner_name> <na/euw/...>
require "net/http"
require "json"
require "date"
# TODO: Insert your own key here!
API_KEY = "<YOUR-RIOT-API-KEY-HERE>"
@summoner_name = ARGV[0]
@kevinadi
kevinadi / unfoldr.scala
Created May 10, 2016 07:09
unfoldr in Scala
def unfoldr[A, B](seed: B)(func: B => Option[(A, B)]): Stream[A] =
func(seed) match {
case Some((a, b)) => a #:: unfoldr(b)(func)
case None => Stream.empty
}
/*
* Infinite sequence:
* val s = unfoldr (0) (b => Some(b,b+1))
* Fibonacci sequence:
@voronianski
voronianski / simple-react-playground.html
Last active April 6, 2024 16:59
Quick React prototyping in browser on the fly with ES2015. Use this as boilerplate for your playground and upload html file on some server. Created as a solution for this challenge - http://blog.vjeux.com/2015/javascript/challenge-best-javascript-setup-for-quick-prototyping.html with the help of https://github.com/voronianski/babel-transform-in-…
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>React Quick Prototyping</title>
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.min.js"></script>
@ethicalhack3r
ethicalhack3r / wp_dos.py
Created August 7, 2014 07:41
WP XML-RPC DoS Exploit
#################################################################################
# CVE-XXXXX Wordpress and Drupal XML Blowup Attack DoS#
# Author: Nir Goldshlager - Salesforce.com Product Security Team#
# This is a Proof of Concept Exploit, Please use responsibly.#
#################################################################################
#!/usr/bin/env python
from __future__ import print_function
import threading
import time
import urllib
@archon810
archon810 / BuildConfig.java
Last active September 28, 2022 15:17
Fake Virus Shield AV
package com.deviant.security.shield;
public final class BuildConfig {
public static final String BUILD_TYPE = "debug";
public static final boolean DEBUG;
public static final String FLAVOR = "";
public static final String PACKAGE_NAME = "com.deviant.security.shield";
public static final int VERSION_CODE = 4;
public static final String VERSION_NAME = "2.2";
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: