Skip to content

Instantly share code, notes, and snippets.

@NapoleonWils0n
NapoleonWils0n / ssh_relay_server.sh
Created November 11, 2012 15:39
ssh: ssh relay server
#!/bin/sh
#-----------------------------------------------------------#
# ssh relay server #
#-----------------------------------------------------------#
# use a ssh server a middle man
# to connect 2 computers behind firewalls
@NapoleonWils0n
NapoleonWils0n / ssh_afp.sh
Created November 11, 2012 01:24
macosx: self closing ssh tunnel for afp file sharing
#!/bin/sh
# self closing ssh tunnel for afp file sharing
SSHSERVER=192.168.1.2
ssh -f -q -L 1548:localhost:548 $SSHSERVER sleep 60 && open afp://localhost:1548
@NapoleonWils0n
NapoleonWils0n / regenerate_a_public_ssh-key_using_private_ssh-key.sh
Created November 11, 2012 01:17
ssh: regenerate a public ssh-key using private ssh-key
#!/bin/sh
# =====================================================
# = REGENERATE A PUBLIC SSH-KEY USING PRIVATE SSH-KEY =
# =====================================================
ssh-keygen -y -f id_rsa > id_rsa.pub
@NapoleonWils0n
NapoleonWils0n / meld_over_ssh.sh
Created November 11, 2012 01:16
ssh: meld over ssh
#!/bin/sh
# ==============================================
# = Using meld to compare directories over ssh =
# ==============================================
# Set up a ssh public private key and copy to your server
meld <(ssh 192.168.1.2 ls Desktop) <(ls Desktop)
@NapoleonWils0n
NapoleonWils0n / mac_osx_sshd_location.txt
Created November 11, 2012 01:16
macosx: mac osx sshd location
=========================
= mac osx sshd location =
=========================
/etc/sshd_config
sudo su
mate /etc/sshd_config
@NapoleonWils0n
NapoleonWils0n / change colour on ssh connections.sh
Created November 11, 2012 01:15
macosx: change colour on ssh connections
#!/bin/sh
# this code goes in your .bash_profile
# change colour on ssh connections and then back to the default theme
function tabc {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
osascript -e "tell application \"Terminal\"
set myWindow to front window
@NapoleonWils0n
NapoleonWils0n / squidman proxy set up.txt
Created November 11, 2012 01:13
macosx: squidman set up
/*----------------------------------------------------------------------------------------*/
/* squidman proxy set up */
/*----------------------------------------------------------------------------------------*/
install squidman
leave the port set to 8080
@NapoleonWils0n
NapoleonWils0n / split_and_cat_files.sh
Created November 11, 2012 01:12
bash: split and cat files
#!/bin/sh
# split files into chunk and rejoin with cat
# zip the file up first then split it, then rejoin it as a zip with cat
# that way when you unzip the file it keeps the original file name
# split -b (filesize in mb)80m file.avi splitprefix_
split -b 80m somefile.zip file_
@NapoleonWils0n
NapoleonWils0n / software_update.sh
Created November 11, 2012 01:12
macosx: software update from the command line
#!/bin/sh
#-----------------------------------------------#
# software update from the command line
#-----------------------------------------------#
# To list the available software updates, use the following command.
sudo softwareupdate -l
# All available software updates can be installed with the following command:
@NapoleonWils0n
NapoleonWils0n / sips_resample.sh
Created November 11, 2012 01:10
macosx: sips resample height width
#!/bin/sh
# sips resample images
sips --resampleHeightWidth 100 80 image.png
sips --resampleWidth 80 image.png
sips --resampleHeight 80 image.png