Skip to content

Instantly share code, notes, and snippets.

View iamtew's full-sized avatar
🤯
My status? I just found the User Status function!

Mikael 'tew' iamtew

🤯
My status? I just found the User Status function!
View GitHub Profile
@iamtew
iamtew / print256colours.sh
Created December 11, 2022 18:58 — forked from HaleTom/print256colours.sh
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
@iamtew
iamtew / super_spinner.bash
Created June 14, 2022 19:25 — forked from yarlson/super_spinner.bash
Super Spinner: An Emoji-based spinner for bash
###
# Super Spinner
# An emoji-based spinner — because ASCII is boring.
#
# Usage:
# $ COMMAND & superSpinner $! "Message"
#
# Example:
# $ sleep 5 & superSpinner $! "Sleeping for 5 seconds"
#
@iamtew
iamtew / Dockerfile
Last active January 24, 2017 14:02
Custom Vamp 0.9.2 Marathon container
# Use the latest 0.9.2 DC/OS release
FROM magneticio/vamp:0.9.2-dcos
# Add our updated confgiruation
ADD https://raw.githubusercontent.com/magneticio/vamp-docker/master/vamp-dcos/application.conf /usr/local/vamp/application.conf
@iamtew
iamtew / nginx_userdir.conf
Created October 16, 2015 09:57 — forked from btbytes/nginx_userdir.conf
User-based Website Directories with Nginx
## REF: http://blog.sbf5.com/?p=6
# For requests starting with a tilde, break them into three components:
# 1. The username, everything after the tilde up to the first slash
# 2. The file location, everything after the username up to the last slash
# 3. The trailing slash(es)
# Then, rewrite to go to the f~/ branch.
location /~ {
if ($request_uri ~ ^/~([^/]*)(/.*[^/]|)(/*)$) {
set $homedir $1;
set $filedir $2;
@iamtew
iamtew / add_swapfile.sh
Created May 19, 2015 13:15
Function to create and configure swap file on Linux. Useful on VPS' and the like where images normally don't come configured with swap by default.
#! /bin/bash
test "$(id -u)" -eq 0 || exit 1
# Create and configurat swapfile
create_add_swapfile() {
test -z $1 && return 1
local size=$(echo ${1} | grep -o -E '^[0-9]*')
local unit=$(echo ${1} | grep -o -E '[^0-9](.*)?$' || echo M)
/* style.css
* Some basic styling to make naked HTML look a bit nicer.
* Related links:
* - http://codepen.io/dredmorbius/pen/KpMqqB?editors=110
* - http://bettermotherfuckingwebsite.com/
* - http://motherfuckingwebsite.com/
*/
a {
color: #1e6b8c;
@iamtew
iamtew / Building_a_ShrimpKey.md
Last active August 29, 2015 14:14
Building a ShrimpKey

ShrimpKey BOM

Got it? Component Amount Tayda part number
ATMEGA328P-PU 1x A-854
✔️ 22pF condensator 2x A-523
✔️ 100nF condensator 4x A-4008
10uF condensator 1x A-4534
✔️ 10kOhm resistor 1x A-2115
✔️ 1N4149 diode 1x [A-157](http://www
@iamtew
iamtew / mk_simple_repo.sh
Last active August 29, 2015 14:08
Dead simple Debian repository generator for simple package hosting
#! /usr/bin/env bash
# mk_simple_repo.sh - Simple Debian repository generator
#
# Prerequisites:
# Packages:
# dpkg-dev
# VirtualHost:
# <Directory /var/www/repos/ >
# Options Indexes FollowSymLinks Multiviews
# Order allow,deny
@iamtew
iamtew / saltstack-notes.md
Last active August 29, 2015 14:07
Notes on SaltStack

Random notes on SaltStack

Some random notes on Saltstack and tools around it

Upgrade the master:

# for X in /etc/init.d/salt-* ; do echo $X ; /sbin/service $(basename $X) stop; rm -vf $X ; done
# for X in /usr/lib/systemd/system/salt-*.service ; do echo $X ; systemctl stop $(basename $X) ; rm -fv $X ; done
# sh install_salt.sh -M -X -P git v2014.7.0rc5 
@iamtew
iamtew / st3-dropbox.sh
Created October 9, 2014 07:31
Sublime Text 3 in DropBox, same config on every box you have!
# Sublime Text 3 in DropBox, same config on every box you have!
# From here:
# http://www.alexconrad.org/2013/07/sync-sublime-text-3-settings-with.html
# Create the sync directory in Dropbox
$ mkdir ~/Dropbox/sublime-text-3/
# Move your ST3 "Packages" and "Installed Packages" to Dropbox
$ cd ~/.config/sublime-text-3/
$ mv Packages/ ~/Dropbox/sublime-text-3/