Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Alex Burghardt aal89

🎯
Focusing
View GitHub Profile
@aal89
aal89 / 10kb.txt
Created Jul 18, 2019
10kb in text
View 10kb.txt
89075337635954647102216077828334038179638965680796041208684221958292459041499210220101176726750119361506928946801115768179724
42244632672758898527798766326186965189573496725417576843236332384515325066967967084729236662659424427203830789178855960389888
59671607161000645588293584669984665020199777828148967747970527020608102921980556435899241646582421992569038754973449362160805
31239955776017464552148435666505635723861800404618684226812752076597749931057757306056294943547000781262839809899923354086591
58421004045160720410218892782153917915938163263152750197199304506126821048289291640271668334925747202569241057032162874410383
13229406649061136455569503589840650992763870062625721531357020224282471379189564485235429826481871222615972206141109473569331
50068277012583532229033541176707338889365478924968936854152065761173915111644345900669149625078722916074227614326832708754591
53533652284306970616530322571286936751979637851359030657540649747647283544275697965879550870371044054664298592239900461215946
7600905955755449
@aal89
aal89 / profile
Last active Oct 1, 2020
Terminal coloring with git branch if one is found
View profile
print_git_data() {
if [ $(parse_git_branch) ]; then
printf ' ('
printf $(parse_git_branch)
printf ' '
printf $(parse_latest_commit_hash)
printf ')'
fi
}
@aal89
aal89 / bitbucket-pr-totals.js
Last active Jun 30, 2020
Show total changed lines of code for all files combined in a PR (new view) on Bitbucket. This is a TamperMonkey script.
View bitbucket-pr-totals.js
// ==UserScript==
// @name Bitbucket totals in PR
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Show total changed lines of code
// @author You
// @match https://bitbucket.org/*/*/pull-requests/*
// @grant none
// ==/UserScript==
@aal89
aal89 / boot.ts
Last active Jan 29, 2020
Bootstrapper (chassis pattern) with a restarting capabilities for TypeScript/Javascript using 'top-level' async/await.
View boot.ts
// random bootstrapper for any theoretical ts/js application
const timeout = (millis: number, fn: () => void) => new Promise(c => setTimeout(c, millis)).then(fn);
(async function boot() {
// this try-catch is an additional safety net used for (poorly) written applications in which errors
// are not properly caught
try {
// some random loading of initial components
@aal89
aal89 / .bash_profile
Last active Dec 17, 2019
Profile alias to quickly execute Python scripts from anywhere on some random path with regard to sys.argv, for *nix systems. Alias gp stands for globalpython.
View .bash_profile
alias gp='function __gp() { (python3 ~/Documents/python/$1.py $(shift;printf "$*") 2>/dev/null) || echo "File not found or errors occurred."; unset -f __gp; }; __gp'
# (assumption hiworld.py is an actual file)
#
# usage: gp hiworld
# usage: gp sub/dir/hiworld arg0 arg1
#
@aal89
aal89 / tgidemo.c
Last active Nov 20, 2019
CC65 TGI NES demo that compiles (taken from https://github.com/cc65/cc65/blob/master/samples/tgidemo.c).
View tgidemo.c
#include <stdio.h>
#include <stdlib.h>
#include <cc65.h>
#include <conio.h>
#include <tgi.h>
#include <nes.h>
#include <joystick.h>
#define TGI_COLOR_BLACK 0x00
#define TGI_COLOR_GREEN 0x01
@aal89
aal89 / mandelbrot.c
Created Nov 20, 2019
CC65 mandelbrot demo for NES that compiles (taken from https://github.com/cc65/cc65/blob/master/samples/mandelbrot.c)
View mandelbrot.c
/*****************************************************************************\
** mandelbrot sample program for cc65. **
** **
** (w) 2002 by groepaz/hitmen, TGI support by Stefan Haubenthal **
\*****************************************************************************/
#include <stdlib.h>
#include <time.h>
@aal89
aal89 / hello.c
Created Nov 20, 2019
CC65 hello world demo for NES with a fix (wa) for the open gap on the bottom line (taken from https://github.com/cc65/cc65/blob/master/samples/hello.c)
View hello.c
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <joystick.h>
#include <nes.h>
static const char text[] = "get on that nesdev";
int main(void)
{
@aal89
aal89 / currying.swift
Last active Sep 26, 2019
Examples whereby we curry an arithmetic operator over a collection of natural numbers and curry a greetings functions over a collection of strings, in Swift.
View currying.swift
// ========================== Generic (limited) curry function:
func curry<A, B, C>(_ f: @escaping (A, B) -> C) -> (A) -> (B) -> C {
return { a in { b in f(a, b) }}
}
// ========================== Example 1:
let add = curry((+) as ((Int, Int) -> Int))
let add2 = add(2)
@aal89
aal89 / faketypes.cs
Last active Sep 20, 2019
UInt128 and UInt256 data types in c# to compare string hashes with one and another.
View faketypes.cs
using System;
using System.Globalization;
using System.Text.RegularExpressions;
namespace FakeTypes
{
// All types within this namespace are considered fakes. A UInt128 is a struct
// containing two ulongs, their primary reason for existence is for quick calculation
// and comparisons of hash strings as numbers. Allocation should be on the stack.