Skip to content

Instantly share code, notes, and snippets.

data:text/csv;base64,MSxhbGEsbWEsa290YQ==
if request.path == "/reload"
self.class.load_settings!
RailsMultisite::ConnectionManagement.each_connection { SiteSetting.refresh! }
return [200, {}, ["success"]]
end
@qoobaa
qoobaa / scanner.sh
Last active December 15, 2015 07:49
#!/bin/bash
while true; do
DEVICE=$(scanimage -f "%d%n" | grep epjitsu)
mkdir -p /tmp/scanner
rm /tmp/scanner/out*.pnm 2> /dev/null
TIMESTAMP=$(date +%Y%m%d%H%M%S)
scanimage -d $DEVICE --mode Lineart --resolution 300 --source "ADF Duplex" --batch=/tmp/scanner/out%03d.pnm 2> /dev/null
if [ -f /tmp/scanner/out001.pnm ]; then
for file in /tmp/scanner/out*.pnm; do
@qoobaa
qoobaa / entries.rb
Last active December 9, 2015 21:18
#!/usr/bin/env ruby
require "csv"
time = 0
CSV.foreach(ARGV.first, headers: true) do |row|
puts "#{row["Start date"]} #{row["Duration"]} #{row["Description"]}"
hours, minutes, seconds = row["Duration"].split(":").map(&:to_i)
time += hours * 3600 + minutes * 60 + seconds
// ==UserScript==
// @name Trello ID
// @author Jakub Kuźma
// @version 0.1.1
// @description Displays IDs on the cards
// @include https://trello.com/*
// ==/UserScript==
var main = function () {
setInterval(function () {
#!/bin/bash
DEVICE=$(scanimage -f "%d%n" | grep epjitsu)
while true; do
rm out*.pnm 2> /dev/null
TIMESTAMP=$(date +%Y%m%d%H%M%S)
scanimage -d $DEVICE --mode Lineart --resolution 300 --source "ADF Duplex" -b 2> /dev/null
if [ -f out1.pnm ]; then
for file in out*.pnm; do
require "socket"
loop do
begin
socket = TCPSocket.new("localhost", 6600)
time = nil
loop do
socket.puts "status"
var rbind = function (context) {
var fn = this,
slice = Array.prototype.slice,
xargs = slice.call(arguments, 1);
return function () {
var args = slice.call(arguments).concat(xargs);
return fn.apply(context || fn, args);
};
};
var waitForError = function (expectedError, done) {
var originalExceptionListener = process.listeners("uncaughtException").pop();
process.once("uncaughtException", function (error) {
process.listeners("uncaughtException").push(originalExceptionListener);
if (error instanceof expectedError) {
done();
} else {
process.nextTick(function () {
// state = {
// deal: {
// n: ["HA", "..."],
// e: ["DA", "..."],
// s: ["SA", "..."],
// w: ["CA", "..."]
// },
// vulnerability: "BOTH",
// dealer: "E",
// bids: ["PASS", "1C", "X", "..."],