Skip to content

Instantly share code, notes, and snippets.

View Aldaviva's full-sized avatar
🆒
This user is COOL

Ben Hutchison Aldaviva

🆒
This user is COOL
View GitHub Profile
@Aldaviva
Aldaviva / LICENSE.txt
Created November 9, 2012 02:43 — forked from 140bytes/LICENSE.txt
ieDownloadBarWidth -- 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Ben Hutchison <aldaviva.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Aldaviva
Aldaviva / Description.md
Last active December 16, 2015 07:59
Film Quotation Completion

Given a film, an incomplete quotation from the film, and multiple-choice completions for the quotation, which completion is from the film?

Film: RoboCop
Question: Come quietly or there will be ______.
Possible answers: fisticuffs, a strongly worded letter, trouble, an altercation
Best answer: trouble

Letterboxd poses these questions as captchas for their sign-up flow.

This solution makes unauthenticated requests to Google's Ajax Search service, which is deprecated and throttled, so a real attack would require a different method of scoring results (like a paid API account, a different search engine, or a botnet).

@Aldaviva
Aldaviva / QuotesResource.java
Created September 8, 2013 17:11
JAX-RS API documentation generation from Javadoc using Aldaviva/harbor. Build with "mvn site"
package vc.bjn.quotes.api.resource;
import vc.bjn.quotes.data.entity.Quote;
import vc.bjn.quotes.data.repo.QuotesRepository;
import vc.bjn.quotes.data.repo.Repository;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
@Aldaviva
Aldaviva / Spring environment-aware configuration
Last active December 22, 2015 17:19
How to use environment-specific configuration in Spring, activated with a Java system property: -Denv=dev
As a Java developer, I want to be able to inject configuration properties into my application as simply
and easily as possible. I want these properties to be different depending on which environment (prod
vs. stage vs. dev) the system is running in. I don't want to generate separate, non-portable build
artifacts for each environment, because they will get confused. I don't want to redefine property values
that are the same across different environments (dev should inherit and override prod, not duplicate
prod). I want the default environment to be prod, so any operations person can be completely oblivious to
this system and still get the correct behavior.
In this example, a servlet application connects to a Mongo database. We want the database hostname to be
different depending on the environment; on prod, Mongo is hosted locally, but in dev, Mongo is on a VM
@Aldaviva
Aldaviva / 1. instructions.md
Last active August 29, 2015 13:56
Flappy Space Program Launch Control
  1. Go to Flappy Space Program
  2. Open Developer Tools (F12)
  3. Paste the contents of launchcontrol.js, below, into the Console tab
  4. When you want to launch a bird, run liftoff() in the Console tab
@Aldaviva
Aldaviva / joinmov.bat
Created January 10, 2015 08:21
Join multiple MOV files into a single MP4 without reencoding (useful for video cameras that split files every 4GB)
@echo off
if "%1"=="" (
echo usage example: join.bat video1.mov video2.mov video3.mov
echo this will create joined.mp4 in the same directory
exit /B 1
)
ffmpeg -version >nul 2>&1 || (
echo ffmpeg missing, install from http://ffmpeg.zeranoe.com/builds/
@Aldaviva
Aldaviva / Linux VPN server.md
Last active January 30, 2023 10:42
OpenVPN client and server configuration with bridging

OpenVPN server configuration for a Linux server like a Raspberry Pi

Prerequisites

  • Linux (tested on Raspbian 10 Buster and 11 Bullseye)
  • OpenVPN (tested on 2.4.7-1 and 2.5.1-3 from apt)
  • bridge-utils (tested on 1.6-2 and 1.7-1 from apt)

Ethernet configuration

/etc/network/interfaces

@Aldaviva
Aldaviva / pre-commit
Last active November 5, 2022 12:55
Prevent commits with FIXME
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@Aldaviva
Aldaviva / gitExtensionsToCodeCollaborator.sh
Last active August 29, 2015 14:18
Add a context menu to Git Extensions to create 1-click code reviews in Code Collaborator
#!/bin/bash
CCOLLAB='C:/Program Files/Collaborator Client/ccollab.exe'
COMMIT_HASH=$1
COMMIT_SUMMARY=$2
USERNAME=ben
"$CCOLLAB" --no-browser addgitdiffs new $COMMIT_HASH~1 $COMMIT_HASH
"$CCOLLAB" admin review edit "last" --title "$COMMIT_SUMMARY"
"$CCOLLAB" admin review set-participants "last" --participant author=$USERNAME
@Aldaviva
Aldaviva / createrooms.ps1
Last active August 29, 2015 14:22
Exchange bulk room creation with Blue Jeans Relay integration
$RoomCsv = Import-Csv .\rooms.csv
foreach ($room in $RoomCsv){
Write-Host "Adding $($room.id)..."
New-Mailbox -Name "$($room.name)" -Room -UserPrincipalName "$($room.id)"
Add-MailboxFolderPermission -Identity "$($room.id):\Calendar" -User relay -AccessRights Reviewer
Set-CalendarProcessing -Identity "$($room.id)" -DeleteComments $false -DeleteSubject $false -AddOrganizerToSubject $false -RemovePrivateProperty $false
}