Skip to content

Instantly share code, notes, and snippets.

const adapters = [80,87,10,122,57,142,134,59,113,139,101,41,138,112,46,96,43,125,36,54,133,17,42,98,7,114,78,67,77,28,149,58,20,105,31,19,18,27,40,71,117,66,21,72,146,90,97,94,123,1,119,30,84,61,91,118,2,29,104,73,13,76,24,148,68,111,131,83,49,8,132,9,64,79,124,95,88,135,3,51,39,6,60,108,14,35,147,89,34,65,50,145,128];
const memo = {};
const calcArrangements = current => {
if (memo[current] !== undefined) {
return memo[current];
}
if (current == Math.max(...adapters)) {
memo[current] = 1;
return 1;
}
@ldjb
ldjb / spotify_2018.md
Created December 23, 2018 16:36
Spotify 2018 songs

Wuthering Heights
Kate Bush

Tom's Diner
Suzanne Vega

Veridis Quo
Daft Punk

Terra’s Theme (Final Fantasy VI)

@ldjb
ldjb / pyo2cm.html
Last active February 27, 2018 10:18
<!DOCTYPE html>
<html>
<head>
<title>Redirecting to Citymapper...</title>
<script>
(function () {
if (!location.href.match(/query=/)) {
document.write("<p>Sorry, I could not retrieve the Pok&eacute;mon's details.</p>");
}
else {
@ldjb
ldjb / [NSIS].nsi
Created August 14, 2017 11:09
Higanbana: The First Night Windows installation script
; NSIS script (UTF-8) NSIS-Park-1 Unicode
; Install
Unicode true
SetCompressor lzma
SetCompressorDictSize 8
; --------------------
; HEADER SIZE: 204776
; START HEADER SIZE: 300
@ldjb
ldjb / pc_reserved.html
Last active March 13, 2018 11:50
This webpage, designed to be displayed fullscreen, attempts to discourage others from fiddling with the PC whilst the user is away.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>[This PC is currently reserved]</title>
<style>
html {
background: #333;
display: table;
height: 100%;
<?php
define("ATOM_FEED", "https://mastodon.social/@Gargron.atom");
define("NEW_STATUS_BY", "New status by");
header("Content-type: application/atom+xml; charset=utf-8");
$data = new SimpleXMLElement(file_get_contents(ATOM_FEED));
$toRemove = [];
(define (depth e)
(if (pair? e)
(+
(apply max
(map depth e))
1)
0))
lambda x, y : 'this is a large number' if x + y > 100 else x + y
<?php
ini_set("display_errors", 0);
define("IX_URL", "http://interactions.acm.org/");
header("Content-type: application/atom+xml");
$doc = new DOMDocument();
$doc->loadHTMLFile(IX_URL);
$container = $doc->getElementById("scroll-container");
$items = $container->childNodes->item(1)->childNodes->item(1)->childNodes;
@ldjb
ldjb / user.js
Created November 30, 2015 21:01
ldjb's preferences file for Firefox and other Gecko-based applications (put it in your profile directory, which you can find via about:support)
// Backspace navigates to previous page
user_pref("browser.backspace_action", 0);
// Disable some time-wasting animations
user_pref("browser.fullscreen.animate", false);
user_pref("browser.tabs.animate", false);
// A single click in the address bar (and search bar) selects the whole field
// (useful when you want to quickly copy the page's URL)
user_pref("browser.urlbar.clickSelectsAll", true);