Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
lucaspiller / gist:c544024738bca2be598f
Created May 20, 2014 14:11
wysihtml5: Tidy HTML pasted from Word
var tidyHtml = function() {
var html = this.getValue();
// remove empty paragraphs
html = html.replace(/<p>(&nbsp;|\s+)?<\/p>/g, "");
html = html.replace(/<p><b>(&nbsp;|\s+)?<\/b><\/p>/g, "");
// remove newlines between words
html = html.replace(/([^>])\n([^<])/g, "$1 $2");
@lucaspiller
lucaspiller / honeypot.c
Created July 3, 2014 17:23
DMCA Honeypot
/*
* This file is not Copyright (C) QUALCOMM Austria Research Center GmbH.
* It is not Copyright (C) Sony Computer Entertainment America LLC ("SCEA").
* It is also not Copyright (C) of Apple Inc. (“Apple”).
* Lastly it is not Copyright (C) Epic Games, Inc.
*/
#include <stdio.h>
int main() {
@lucaspiller
lucaspiller / dates.rb
Last active August 29, 2015 14:04
HMRC Residency Check
require 'active_support/core_ext'
in_out = :out
out_days = 0
in_days = 0
transit_days = 0
last = "2013-05-06".to_date
@lucaspiller
lucaspiller / active_job.rb
Created May 11, 2015 12:41
ActiveJob + Cucumber
# features/support/active_job.rb
# Specify the inline adapter so jobs run straight away
Rails.application.config.active_job.queue_adapter = :inline
sudo apt-get install mongodb ◼ version:2.1.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libabw-0.0-0 libatkmm-1.6-1 libboost-filesystem1.55.0 libboost-program-options1.55.0 libboost-regex1.55.0 libcairomm-1.0-1 libdrm-dev libe-book-0.0-0 libegl1-mesa-dev libetonyek-0.0-0 libfreehand-0.0-0 libgl1-mesa-dev libglibmm-2.4-1c2a libgtkmm-2.4-1c2a libmwaw-0.2-2 libpangomm-1.4-1 libwayland-dev libx11-xcb-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev libxcb-randr0 libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxshmfence-dev libxxf86vm-dev
mesa-common-dev x11proto-dri2-dev x11proto-gl-dev x11proto-xf86vidmode-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
binutils binutils-dev cpp cpp-5 dbus g++ g++-5 gcc gcc-5 gcc-5-base libabw-0.1-1 libapparmor1 libasan2 libatomic1 libboost-date-time1.58.0 li
@lucaspiller
lucaspiller / prepare-commit-msg.sh
Created October 8, 2015 11:34
Automatic @vjt style Git commit messages
#!/bin/sh
# Install this in your Git repo in .git/hooks/prepare-commit-msg. Git doesn't
# support global hooks, but you can work around it using templates, see:
#
# https://github.com/mroth/lolcommits/wiki/Enabling-Lolcommits-for-all-your-Git-Repositories.
ORIGINAL_COMMIT_MSG=$(cat "$1")
# from http://www.emoji-cheat-sheet.com/
%%%-------------------------------------------------------------------
%%% File : quad_tree.erl
%%% @author Jamie Burrell
%%% @doc Erlang implementation of a quadratic tree.
%%% @end
%%% @since 2009-02-10
%%% @end
%%%-------------------------------------------------------------------
-module(quad_tree).
#!/bin/sh
# This has to be run from develop
git checkout develop
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
@lucaspiller
lucaspiller / Gemfile
Last active April 22, 2016 02:03
photos2tidy.rb - scripts to free your photos from Photos.app
source "httpso://rubygems.org"
gem 'sqlite3'
gem 'exiftool'
Timestamp Temperature (C) Humidity (RH) Voltage (V)
2016-02-16 03:45:51.530868318 +0000 UTC -3.1 84.8 3.812
2016-02-16 03:50:41.837109716 +0000 UTC -3.1 84.8 3.806
2016-02-16 03:55:31.840826361 +0000 UTC -3.1 85 3.808
2016-02-16 04:00:22.152985775 +0000 UTC -3.1 84.9 3.805
2016-02-16 04:05:12.152659933 +0000 UTC -3.1 85.3 3.807
2016-02-16 04:10:02.032545988 +0000 UTC -3.1 85 3.802
2016-02-16 04:14:52.157674259 +0000 UTC -3.1 84.7 3.799
2016-02-16 04:19:42.160287768 +0000 UTC -3.2 84.5 3.8
2016-02-16 04:24:32.185451128 +0000 UTC -3.2 84.2 3.801