Skip to content

Instantly share code, notes, and snippets.

@und3f
und3f / battlesnake-public-snakes.md
Created February 11, 2024 20:33
Battlesnake.com public snakes

Top 10:

  • Hovering Hobbs

Top 20:

  • #!/bin/shnake

Top 50:

  • SmartyTree
@und3f
und3f / MillionDWords.java
Created November 29, 2021 09:40
Sort million 32-bit integers
import java.util.Random;
import java.util.Arrays;
import java.time.*;
import java.time.temporal.*;
public class MillionDWords {
final static int million = 1_000_000;
final static int runs = 100;
public static void main(String []argc) {
int[] numbers = new Random().ints(million, Integer.MIN_VALUE, Integer.MAX_VALUE).toArray();
@und3f
und3f / adv13-part1.js
Last active October 17, 2021 09:12
AOC 2017 day 13 in-browser solutions
(function(input) {
let firewall = []
for (let wall of input.split("\n").map(r => r.split(": "))) {
firewall[parseInt(wall[0])] = parseInt(wall[1])
}
let severity = 0
for (let position = 0; position < firewall.length; position++) {
const scannerTower = firewall[position]
let scanner
@und3f
und3f / pairwise.js
Created January 6, 2020 15:16
Pairwise
function pairwise(arr, arg) {
let sum = 0;
let arrIndexes = arr.map((v, i) => i);
arrIndexes.sort((a, b) => {
let s = arr[a] - arr[b];
if (s === 0)
s = b - a;
return s;
});
filters:
- JLogger::Filter::and:
filters:
- JLogger::Filter::or:
filters:
- JLogger::Filter::FieldEq:
fields:
from: "a@server.com"
to: "a@server.com"
- JLogger::Filter::FieldEq:
#!/bin/sh
sleep 10
echo Executed
@und3f
und3f / asianet-pinger.pl
Created February 23, 2015 02:51
Asianet broadbend pinger
#!/usr/bin/env perl
# Asianet Broadband automatical pinger
# Copyright (c) 2015, Sergii Zasenko
use strict;
use warnings;
$| = 1;
use LWP::UserAgent;
@und3f
und3f / midi2speaker.pl
Created May 3, 2012 11:29
MIDI interface to the internal speaker
#!/usr/bin/env perl
use strict;
use warnings;
use Audio::Beep;
use MIDI::ALSA qw(
SND_SEQ_EVENT_NOTEON
SND_SEQ_EVENT_NOTEOFF
SND_SEQ_EVENT_PORT_UNSUBSCRIBED);
@und3f
und3f / gist:2584816
Created May 3, 2012 09:58
Connect MIDI keyboard to midi2speaker
% aconnect -lo
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 16: 'M Audio Audiophile 24/96' [type=kernel]
0 'M Audio Audiophile 24/96 MIDI'
client 20: 'CME M-KEY' [type=kernel]
0 'CME M-KEY MIDI 1'
client 128: 'Midi2Speaker' [type=user]
0 'Input port '
% aconnect 20 128
@und3f
und3f / no-more-blues.pl
Created May 2, 2012 20:40
No more blues with internal speaker
use Audio::Beep; Audio::Beep->new->play(join ' ', <DATA>);
__DATA__
\bpm240
f2 a, d2. f4 e2 b2 d2.
e4 f2 bes cis2.
f4 e d8 f4 f6 e d a1
f'2 a,2 b d c4 e2
r4 e d c c4 bes2
r4 f e d d cis e c bes2. r4