Skip to content

Instantly share code, notes, and snippets.

View turesheim's full-sized avatar

Torkild U. Resheim turesheim

View GitHub Profile
#!/bin/bash
# This Bash script will set up an Ubuntu installation so that it will be able
# to build SIMA.
t=$(tempfile) || exit
trap "rm -f -- '$t'" EXIT
# We need this for dialogs
#command -v dialog >/dev/null 2>&1 || { sudo apt-get install dialog }
function FindProxyForURL(url, host) {
var ProxyConfig = "DIRECT";
if( dnsDomainIs(host, ".cp.ads.domstol.no")) {
ProxyConfig = "SOCKS localhost:1283";
}
return ProxyConfig;
}
@turesheim
turesheim / java.zsh
Last active June 7, 2022 19:18
maxOS Zsh script to easily switch between Java versions
#!/usr/local/bin/zsh
# Add aliases for changing java runtime
alias j6='ju 1.6'
alias j7='ju 1.7'
alias j8='ju 1.8'
alias j9='ju 9'
# Prints the path to JAVA_HOME
alias jh=/usr/libexec/java_home
@turesheim
turesheim / envoy.yaml
Created October 31, 2019 19:01
Envoy configuration for handling gRPC and HTTP requests to the same port
# =============================================================================
# This Envoy configuration allows gRPC and HTTP/2 connections to be sent to the
# same port. The URL to the gRPC service must be prefixed with "/grpc", for
# instance "http://192.168.1.10/grpc" and will be directed to port 8082. The
# normal HTTP/2 calls will be directed to port 8084.
# =============================================================================
admin:
access_log_path: /tmp/admin_access.log
address:
#! /usr/bin/env python
'''
Register a mDNS/DNS-SD alias name for your computer using the Avahi daemon
This script will register an alternate CNAME alias besides your hostname,
which could be useful for ex. when serving several http virtual hosts to
your ffriends on the local network and you don't want to make them configure
their /etc/hosts.
Why a CNAME? You could also publish your current address with avahi-publish-address
@turesheim
turesheim / derby
Created July 17, 2013 09:19
Apache Derby startup script.
#!/bin/bash
#
# Startup script for Derby
#
# chkconfig: 345 94 16
# description: Derby startup script
# to enable on bootup on redhat "chkconfig --level 35 derby on"
# to enable on bootup on debian "update-rc.d derby defaults" or the
# slightly longer (but better run levels) "update-rc.d derby start 91 2 3 4 5 . stop 20 0 1 6 ."
@turesheim
turesheim / style.css
Last active August 6, 2017 06:14
GitHub style for Eclipse WikiText
body {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
text-size-adjust: 100%;
color: #333;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
font-size: 0.8em;
line-height: 1.6;
word-wrap: break-word;
}
@turesheim
turesheim / gist:956648
Created May 5, 2011 06:47
Invoking Eclipse Wizard programmatically
public void openWizard(String id) {
// First see if this is a "new wizard".
IWizardDescriptor descriptor = PlatformUI.getWorkbench()
.getNewWizardRegistry().findWizard(id);
// If not check if it is an "import wizard".
if (descriptor == null) {
descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
.findWizard(id);
}
// Or maybe an export wizard
@turesheim
turesheim / keybase.md
Last active April 7, 2016 12:37
Keybase proof

Keybase proof

I hereby claim:

  • I am turesheim on github.
  • I am tur (https://keybase.io/tur) on keybase.
  • I have a public key whose fingerprint is F8D8 A122 8186 3176 DCAA C1DA F243 E32D AAB6 F214

To claim this, I am signing this object:

@turesheim
turesheim / pixma2pdf.sh
Last active December 27, 2015 08:09
Bash script to scan documents to PDF.
#!/bin/bash
#-----------------------------------------------------------------------------
# pixma2pdf.sh version 3.0
#
# Copyright (c) 2009, 2013 Torkild U. Resheim - torkildr@gmail.com
# Released under the Eclipse Public License version 1.0
#-----------------------------------------------------------------------------
t=$(tempfile) || exit
trap "rm -f -- '$t'" EXIT