Skip to content

Instantly share code, notes, and snippets.

View 4np's full-sized avatar

Jeroen Wesbeek 4np

  • ServiceNow
  • The Netherlands
View GitHub Profile
@4np
4np / GNU Screen long login names on Mac.md
Last active February 24, 2022 16:55
GNU Screen for Mac, patched to allow long loginNames

GNU Screen is a virtual console multiplexer, and it has long been available on Mac. However, it was developed with login names of 20 characters or less in mind. Nowadays it is possible that login names actually exceed the 20 character limit (for example when using Active Directory), resulting in Screen quiting with the nice error message LoginName too long - sorry and rendering Screen useless on these Macs.

Below are the steps to download, patch and compile screen yourself to allow login names of up to 255 characters.

$ cvs -z3 -d:pserver:[email protected]:/sources/screen co screen
$ cd screen/src
$ curl "https://raw.github.com/pclouds/pclouds-overlay/master/app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch"|patch
$ for x in Makefile.in config.h.in configure process.c pty.c screen.cc windows.c; do 
  curl "http://www.opensource.apple.com/source/screen/screen-16/patches/${x}.diff?txt" | patch
@4np
4np / gist:5270037
Last active July 30, 2018 16:26
How to set up a SSL / NON-SSL proxy to Tomcat (or any other service) on Mac OS 10.7 Lion

Apache HTTPS proxy

First, follow the installation guide at Andy Hunt's Blog

Set up a http and https proxy for Tomcat on 8080

In addition to Andy's guide above, perform the following steps:

Add a directory to hold Apache virtual host configurations

@4np
4np / countDownToTheWeekend.sh
Last active June 5, 2018 06:35
Calculate the number of seconds until weekend :) Works especially well together with Geektools and bash geeklet that runs every second... Shows a party hat (🎉) when it's weekend :)
#!/bin/sh
NOW=`date +"%s"`
NEXT_FRIDAY=`date -v+fri +"%m%d"`
FRIDAY_5PM=`date -j $NEXT_FRIDAY"1700" +"%s"`
SECONDS_LEFT=$[$FRIDAY_5PM - $NOW]
DAY_OF_THE_WEEK=`date +"%u"`
# is it weekend yet?
if [[ ( $SECONDS_LEFT -lt 0 || $DAY_OF_THE_WEEK > 5 ) ]]; then
# yes! It's weekend
@4np
4np / updatePiratebayProxy.sh
Created May 6, 2013 23:44
cronjob to automatically update a piratebay proxy to the latest version
#!/bin/sh
# usage:
# m h dom mon dow command
# * */4 * * * ~/scripts/updatePiratebayProxy > /dev/null
# Configuration
HOSTNAME=tpb.example.com
REPO_BASE=~
DESTINATION=/etc/apache2/sites-available/example.com_tpb.conf
ACCESS_LOG=/var/log/apache2/example.com_tpb-access.log
@4np
4np / twilio.sh
Last active December 17, 2015 08:59
Some bash commands for easily interacting with Twilio
# Twilio Commands
# put this in your ~/.profile
TWILIO_MASTER_SID=put here your master SID
TWILIO_MASTER_TOKEN=put here your master token
TWILIO_BASE_URL=https://api.twilio.com/2010-04-01/
TWILIO_CREDENTIALS=$TWILIO_MASTER_SID":"$TWILIO_MASTER_TOKEN
twilio() {
if [ ! "$1" ]; then
echo "Usage:"
echo "------"
@4np
4np / spindown.sh
Created July 6, 2013 09:25
Save battery by spinning down the secondary harddrive and exclude it from Spotlight indexing
# spindown after 1 minute of inactivity
sudo pmset -a disksleep 1
# disable spotlight indexing and searching
sudo mdutil -d /Volumes/Your_Secondary_Harddrive
@4np
4np / TwilioAutoSuspend.sh
Last active December 21, 2015 08:49
Shell script to batch-suspend Twilio sub accounts based on regular expressions and whitelists. Also see https://gist.github.com/4np/5583898 for command line interactions with Twilio. See comment section for screenshots...
#!/bin/sh
# Batch Auto Suspender for Twilio Sub Accounts
# Copyright (C) 2013 Jeroen Wesbeek <work AT osx.eu>
##################### USAGE #######################
#
# Run the script command line or using a cron job:
# ~ $ ./TwilioAutoSuspend.sh
#
# To try out your patterns and whitelist, use the
# -p (pretent) argument. This will only output to
@4np
4np / org.apache.tomcat.plist
Created October 23, 2013 14:06
LaunchDaemon for auto starting Apache Tomcat on Mac OS X. Make sure you set the 'user' and the 'JAVA_HOME' properly. To find out where JAVA_HOME is on your machine run '/usr/libexec/java_home -v 1.6' or '/usr/libexec/java_home -v 1.7'. Follow this guide to install Tomcat --> http://wolfpaulus.com/jounal/mac/tomcat7/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>org.apache.tomcat</string>
<key>ServiceDescription</key>
<string>Tomcat Servlet/JSP Server</string>
@4np
4np / pushit.sh
Last active January 2, 2016 09:39
play 'push it' sample in Mac OS X
#!/bin/sh
# get / set volume
volume() {
if [ -z $1 ]; then
local volume=`osascript -e 'output volume of (get volume settings)'`
local muted=`osascript -e 'output muted of (get volume settings)'`
echo $volume $muted
else
osascript -e 'set volume output volume '$1
@4np
4np / install-commit-hook.sh
Last active January 2, 2016 09:39
This gist will install a Git pre commit hook that will play a 'push it' sample from the Salt N Peppa song… :P
#!/bin/sh
# get global git template dir
if [ `git config --global init.templatedir` ]; then
TEMPLATE_DIR=`git config --global init.templatedir`
else
# there is no git template dir yet, set it
git config --global init.templatedir ~/.git
TEMPLATE_DIR=~/.git
fi