Skip to content

Instantly share code, notes, and snippets.

View A1rPun's full-sized avatar
🌊
Fractalicious

Thom Bakker A1rPun

🌊
Fractalicious
  • The Netherlands
View GitHub Profile
@seisvelas
seisvelas / y_c.md
Last active February 29, 2020 23:21
Journaling my attempt at implementing the Y combinator

I'm going to try to implement the Y combinator without looking! Why? Because I'm procrastinating. I have work to do, but don't want to, and its the weekend, but I can't do pure recreational because I compulsively need to do something that feels legitimized with the veneer of 'learning' in a skill tangentially related to 'my career', so here goes.

The Formula

This is basically cheating, but off the top of my head I recall that the formula for how the Y combinator looks goes something like this:

Y(f) = f(f . f)(f) yeah no I don't remember at all. It has the messy spaghetti quality of nested function calls that

@seisvelas
seisvelas / fib.sql
Created July 30, 2019 21:30
Recursive Fibonacci sequence up to nth number in SQL
WITH RECURSIVE fib (a, b, n) AS (
SELECT 0, 1, 1
UNION ALL
SELECT b, a+b, n+1 FROM fib
)
SELECT a FROM fib WHERE n<=8;
@seisvelas
seisvelas / poem.js
Created November 7, 2018 04:03
A symptom of studying Node.js
try { 2; console; 'myself'; }
catch (myself) { falling.asleep(instead) }
var ious = times = (wondering) => {
if (this.strange_dream(ends) &
"I'll wake up".and)
return home; }
@jamesfreeman959
jamesfreeman959 / keepawake.ps1
Last active April 23, 2024 17:26
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@dduan
dduan / Makefile
Created December 29, 2017 04:13
"Hello, World!" In WebAssembly
compile:
wat2wasm main.wat -o main.wasm
serve:
python -m SimpleHTTPServer
@renanpvaz
renanpvaz / f.js
Last active April 14, 2019 23:01
JavaScript function pattern matching inspired by Haskell's
f = (...fns) => {
const [main, ...variations] = fns.reverse()
const ƒunction = (...appliedArgs) => {
const variation = variations.find(
args => appliedArgs.every(
(appliedArg, i) => args.slice().splice(0, args.length - 1)[i] === appliedArg
)
)
@sebastiencs
sebastiencs / volume.sh
Last active February 13, 2024 11:19
Script to get volume notification with dunst http://imgur.com/a/qWgAw
#!/bin/bash
# You can call this script like this:
# $./volume.sh up
# $./volume.sh down
# $./volume.sh mute
function get_volume {
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 25, 2024 15:17
Hyperlinks in Terminal Emulators
@morgaine
morgaine / fib_multi.erl
Last active September 17, 2019 18:28
Fibonacci in Erlang, multiple algorithms, commandline interface
#! /bin/env escript
% NAME
% fib_multi.erl -- Multiple algorithms for Fibonacci numbers
%
% SYNOPSIS
% fib_multi {from-integer} [{to-integer}]
%
% INSTALL
% ln -s fib_multi.erl fib_multi
@vidul-nikolaev-petrov
vidul-nikolaev-petrov / ascci_hex_string.js
Created December 19, 2016 16:13
Tiny helpers: ASCII HEX STRING
function string2ascii(string, sep) {
return string.split('')
.map(e => e.charCodeAt(0)).join(sep ? sep : '');
}
function string2hex(string, sep) {
return string.split('')
.map(e => e.charCodeAt(0).toString(16)).join(sep ? sep : '');
}