Skip to content

Instantly share code, notes, and snippets.

View soren's full-sized avatar

Søren Lund soren

View GitHub Profile
#!/usr/bin/env bash
#
# INTRODUCTION
#
# Defines a function called aws-profile to list and select AWS profile
# to use. The function is meant for interactive use. You use it to
# select and set the current AWS Profile by setting the AWS_P#ROFILE
# environment variable.
#
@soren
soren / JdbcCheck.java
Created January 16, 2013 08:31
A simple Java utility to test database connections using JDBC.
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 {
function show_env_vars() {
env \
| sort -t= -k1 \
| sed -e '1 i\Environement Variable\tValue\n=====================\t=====' -e 's/=/\t/' \
| column -ts$'\t' \
| cut -c-$COLUMNS \
| less -F
}
@soren
soren / scancalc.html
Created July 6, 2012 06:51
ScanCalc - a small JavaScript utility to convert between centimeters (cm), pixels and dots/inch (dpi).
<!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; }
@soren
soren / big_clock.pl
Last active April 26, 2021 12:30
# Display a big clock using blocks made from reverse video spaces
#!/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 March 19, 2021 07:44
Code from the column "Sorting with the Schwartzian Transform" published in "Unix Review" issue 64 (May 2006)
#!/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";
# 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 ; }
@soren
soren / foo.pod
Last active December 18, 2018 14:29
#!/usr/bin/env perl use strict; use warnings; use utf8; use File::Basename qw(basename); use Pod::Usage; use App::TimeClock;

Markdown Demo

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

See also reStructuredText and Wikipedia