Skip to content

Instantly share code, notes, and snippets.

@page
{
margin: 15mm;
padding: 1em;
@top-left
{
content: element(header);
}
@bottom-left
{
@pilsna
pilsna / day-1.py
Created December 1, 2021 16:36
Advent of Code 2021
# Part 1
with open('day-1.txt') as textfile:
measurements = textfile.readlines()
previous_measurement = -1
count = -1
for line in measurements:
measurement = int(line.rstrip())
if measurement > previous_measurement:
count += 1
@pilsna
pilsna / git-status
Last active June 22, 2020 21:35
Show git status and remotes of multiple folders. Fork of https://gist.github.com/mzabriskie/6631607
#!/bin/bash
dir="$1"
# No directory has been provided, use current
if [ -z "$dir" ]
then
dir="`pwd`"
fi
@pilsna
pilsna / index.html
Created August 30, 2017 09:55
Temp & Hum in Nordhavn // source http://jsbin.com/gusacev
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<meta name="description" content="Temp & Hum in Nordhavn">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style id="jsbin-css">
body {
background-color: black;
@pilsna
pilsna / index.html
Created August 30, 2017 09:54
swapDecimalComma Swap Decimals and Commas in a text // source http://jsbin.com/cevini
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Swap Decimals and Commas in a text">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>swapDecimalComma</title>
</head>
<body>
<p id="number">801.332,64</p>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pilsna
pilsna / touchsound.md
Last active February 15, 2017 20:47
Experiments with Web Audio API and mouse/touch events

touchsound

Experimenting with smartphones as input for sound generation and performance.

Input

Will look into using the following device features as input (http://mobilehtml5.org/)

  • Touch events
  • Microphone (HTML Media Capture & Web Speech API)
  • Light (Ambient light events)
  • Motion sensors (Accelerometer, Gyroscope, Magnetometer)
@pilsna
pilsna / stringToHex.py
Last active February 15, 2017 11:51
Hex format used in the BLE pairing process of the Anyware Smart Adapter
import sys
arg = sys.argv
if len(arg) < 2:
print "Usage: python tohex.py [string]"
sys.exit()
string = arg[1]
print string
hexString = ''
@pilsna
pilsna / docker.log
Created January 18, 2017 20:22
elektrikeruddannelsen
nils at smorkniv in elektrikeruddannelsen.dk/ on docker
% docker run -ti --rm --name="elektrikeruddannelsen.dk" -v $PWD:/home/user/mnt -p3000:3000 -p5000:5000 -p8000:80 elektrikeruddannelsen.dk
[ ok ] Starting MySQL database server: mysqld ..
[info] Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
[....] Starting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
. ok
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts will run only for `npm publish`.
@pilsna
pilsna / gist:ec187ecaaa4e72f62179
Created October 27, 2015 01:06 — forked from chrisle/gist:2252209
CURL as GoogleBot 2.1
curl --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" -v $@