Skip to content

Instantly share code, notes, and snippets.

View dessibelle's full-sized avatar
🦊
Yes

Simon Fransson dessibelle

🦊
Yes
View GitHub Profile
@dessibelle
dessibelle / download-website.sh
Created September 18, 2012 09:26
Shell script: Download website
#!/usr/bin/env bash
if [ $# -gt 0 ] ; then
URL=$1
else
while :
do
read -p "Site: " URL
if [ -n "$URL" ] ; then
@dessibelle
dessibelle / aws-console.sh
Last active March 30, 2023 09:44
Open an AWS console using separate Chrome profiles
#!/bin/bash
SCRIPT_NAME=$(basename $0)
function print_usage() {
echo "Usage:"
echo -e "\t${SCRIPT_NAME} [-p | --prompt <aws-vault prompt>] <aws_profile>"
echo -e "\nHint: set AWS_VAULT_PROMPT to e.g. 'ykman' to have aws-console default to ykman."
}
@dessibelle
dessibelle / install-wordpress.sh
Created May 12, 2012 13:24
Shell script: WordPress install script
#!/usr/bin/env bash
# == ABOUT ==
# Gets localized version of WordPress and plugins from svn, sets up wp-config.php
# and creates database, downloads some standard components from github (and local
# git server) and runs theme template setup.
# == INSTALLATION ==
#
# Install script: git clone git://gist.github.com/2666478.git tmp.$$; sudo mv tmp.$$/install-wordpress.sh /usr/bin/; chmod 755 /usr/bin/install-wordpress.sh; rm -rf tmp.$$/;
@dessibelle
dessibelle / wordpress-nfd-to-nfc-filename-conversion.sh
Created January 31, 2013 19:39
Two commands needed to perform UTF-8 NFD to NFC decomposition on all files in a directory, and uploading the resulting directory to a webserver. Useful for treating files created on a Linux server (NFC), downloaded to Mac OS X (NFD) and needing to be uploaded back to the original server (NFC). Must, naturally, be run on Linux or at least used on…
#!/usr/bin/env bash
convmv -f utf8 -t utf8 --nfc --replace --nosmart --no-test -r uploads/
rsync -avz -e ssh uploads/ username@host:mysite.com/public_html/wordpress/wp-content/uploads
@dessibelle
dessibelle / git-grep-subl.sh
Last active March 21, 2018 09:13
Open git grep matches in Sublime
#!/usr/bin/env bash
files=`git grep --name-only ${1:+"$@"} | awk '{printf "%s ",$0} END {print ""}'`
if [[ ! -z "${files// }" ]] ; then
subl . && subl $files
else
echo "No matches."
fi

Keybase proof

I hereby claim:

  • I am dessibelle on github.
  • I am simonfransson (https://keybase.io/simonfransson) on keybase.
  • I have a public key ASBqmr6XF0GaMSNj6gpW2bQK6-ccdOGJOtQnh1QhGrXsWwo

To claim this, I am signing this object:

Is it Friday yet? Is the weekend here?
Is it time for me to kick things off with an ice cold beer?
Been working so dang hard that I forget:
Is it Friday yet?
8 o'clock on Monday morning
All I think about is when the day will end
Gotta make a living somehow
That's the way it is for me and all my friends
@dessibelle
dessibelle / wifi-mount.sh
Last active December 29, 2015 13:29
Connects AFP shares (or any URL/path compatible with open really) depending on currently connected wifi network. Ideally executed using `cron` or `launchd`
#!/usr/bin/env bash
PROGRAM_NAME=`basename $0`
DEBUG=false
TARGET_ROUTER_MAC=()
SHARE=()
function debug {
[ $DEBUG == true ] && echo "$1"
@dessibelle
dessibelle / wp-mini-json-api.php
Last active December 23, 2015 19:19
Miniature JSON API for WordPress, returning posts of a specified post type in JSON format
<?php
class WPMiniJSONAPI {
const API_ACTION_QUERY_VAR = "my-api";
const API_PERMALINK_PART = "api";
const API_EVENTS_PERMLINIK_PART = "events";
const API_OUTPUT_FORMAT = "json";
const API_EXPORT_EVENTS = "export-events";
@dessibelle
dessibelle / ssh-transfer-key.sh
Last active December 23, 2015 17:29
Transfers your public SSH key (id_rsa.pub) to the authorized_keys file of a remote computer, allowing for password-less login.
#!/usr/bin/env bash
PROGRAM_NAME=`basename $0`
ARGS=`getopt u:H:h "$@"`
KEY_PATH=~/.ssh/id_rsa.pub
if [ $? != 0 ] ; then
echo "Error parsing arguments. Try $PROGRAM_NAME -h" > /dev/stderr
exit 2