Skip to content

Instantly share code, notes, and snippets.

Avatar

Søren Lund soren

View GitHub Profile
@soren
soren / JdbcCheck.java
Created Jan 16, 2013
A simple Java utility to test database connections using JDBC.
View JdbcCheck.java
import java.io.Console;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
public class JdbcCheck {
@soren
soren / big_clock.pl
Last active Apr 26, 2021
# Display a big clock using blocks made from reverse video spaces
View big_clock.pl
#!/usr/bin/env perl
# Display a big clock using blocks made from reverse video spaces
use warnings;
use strict;
use feature qw(signatures);
no warnings qw(experimental::signatures);
use utf8;
@soren
soren / schwartzian_transform.pl
Created Mar 19, 2021
Code from the column "Sorting with the Schwartzian Transform" published in "Unix Review" issue 64 (May 2006)
View schwartzian_transform.pl
#!/usr/bin/env perl
# Based on code from http://www.stonehenge.com/merlyn/UnixReview/col64.html
use strict;
use warnings;
use Data::Dumper;
print "Input \$str\n";
@soren
soren / scancalc.html
Created Jul 6, 2012
ScanCalc - a small JavaScript utility to convert between centimeters (cm), pixels and dots/inch (dpi).
View scancalc.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ScanCalc</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
table { border-collapse:collapse; }
th { background-color: #ccc; }
th,td { padding:3px; }
View StarTrekPicardWatchGuide.md
View bash-ssh-agent-init.sh
# Setup/start ssh agent
env=~/.ssh/agent.env
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
agent_start () {
(umask 077; ssh-agent >| "$env")
. "$env" >| /dev/null ; }
View foo.pod
#!/usr/bin/env perl use strict; use warnings; use utf8; use File::Basename qw(basename); use Pod::Usage; use App::TimeClock;
View Markdown.md

Markdown Demo

This is Markdown, a simple lighteight markup language that is readable in source form.

See also reStructuredText and Wikipedia

View reStructuredText.rst

reStructuredText Demo

This is reStructuredText, a simple lighteight markup language that is readable in source form.

See also Markdown and Wikipedia

@soren
soren / AltMouseWindowMove.ahk
Created Dec 30, 2013
Move Windows by holding Alt and clicking (and holding) the left mouse button anywhere in the window.
View AltMouseWindowMove.ahk
; Move Windows by holding Alt and clicking (and holding) the left mouse button anywhere in the window.
; You'll need http://www.autohotkey.com to use this script
LAlt & LButton::
CoordMode, Mouse ; Switch to screen/absolute coordinates.
MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin
WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin%
WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin%
if EWD_WinState = 0 ; Only if the window isn't maximized
SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it.