Skip to content

Instantly share code, notes, and snippets.

@antila
antila / flashing-cloud.ino
Created May 19, 2019
Flash Arduino cloud
View flashing-cloud.ino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 7
// How many NeoPixels are attached to the Arduino?
@antila
antila / roll20-max-video-size.js
Last active Oct 17, 2016
Makes roll20 video boxes take up all avaliable screen size.
View roll20-max-video-size.js
$('#hax').off('.hax').remove();
var $videoSettings = $('<input id="hax" type="range" min="200" max="1000"/>');
$videoSettings.appendTo($('#mysettings .content'));
var inputChange = function() {
var windowSize = $(this).val();
$('.video').css('min-width', windowSize);
$('.video').css('min-height', windowSize * (3/4));
$('#playerzone.largevideo object, #playerzone.largevideo .OT_root, .OT_widget-container').attr('style', 'width: ' + windowSize + 'px !important; height: ' + windowSize * (3/4) + 'px !important;');
$('.playername').css('max-width', '100%');
View cloud.ino
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 6
// How many NeoPixels are attached to the Arduino?
#define NUM_LEDS 60
// How much the light should dim per loop
#define falloff 1
View arduino.ino
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
View update-public-ssh-keys.sh
# Nuke my old keys
rm /home/aantila/.ssh/authorized_keys
# Grab new one
gpg2 --recv-keys 0A361939
gpgkey2ssh 700C8678 >> /home/aantila/.ssh/authorized_keys
# ... and add a comment
sed -i.bak s/COMMENT/"anders@antila.se-yubikey"/g /home/aantila/.ssh/authorized_keys
View largestPrime.c
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <inttypes.h>
int64_t divide_into_largest_factor(int64_t input) {
int64_t divisor = 2;
if (2 < input) {
while (divisor < (sqrt(input)+1)) {
if (input % divisor == 0) {
@antila
antila / links.txt
Created Dec 11, 2014
node-webkit links
View links.txt
@antila
antila / keybase.md
Created Sep 22, 2014
Keybase Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am antila on github.
  • I am antila (https://keybase.io/antila) on keybase.
  • I have a public key whose fingerprint is 5E16 4F77 A1C9 92A9 3931 EEC2 EB8B 8761 935F 6073

To claim this, I am signing this object:

@antila
antila / touch-less.sh
Created Nov 21, 2013
Assetic isn't avare of file changes in files @imported in LESS/SASS. This hack touches the main theme file that imports them, to force a recompile. See https://github.com/kriswallsmith/assetic/issues/79
View touch-less.sh
#!/bin/sh
hash inotifywait 2>/dev/null || { echo >&2 "I require package inotify-tools but it's not installed. Try: apt-get install inotify-tools"; exit 1; }
while true;
echo "Waiting for changes in .less-files."
do N=`find src -name "*.less" `;
inotifywait -qe modify $N;
echo "Touching: src/Cos/Bundle/CosBundle/Resources/public/themes/oden/theme.less"
@antila
antila / gist:5371352
Last active Dec 16, 2015
Wordpress woes
View gist:5371352

The Divine Comedy

“Through me you pass into the city of woe: Through me you pass into eternal pain: Through me among the people lost for aye. Justice the founder of my fabric moved: To rear me was the task of power divine, Supremest wisdom, and primeval love. Before me things create were none, save things