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
#! /usr/bin/env bash
# Skip all of this if we don't have a TTY
tty -s || return 0
# Colors + \[...\] wrapping to ensure there's no odd wrapping on command line
C_OFF="\[$(tput sgr0)\]"
C_BOLD="\[$(tput bold)\]"
C_BLACK="\[$(tput setaf 0)\]"
C_RED="\[$(tput setaf 1)\]"
@iamtew
iamtew / dell-get-sysinfo
Created November 27, 2013 12:46
A lot of times I need to lookup info on a Dell service tag. This quick and dirty script works for me, might be useful for someone else as well.
#! /bin/bash
# We need one input at least
if [ $# -lt 1 ]
then
echo "Error: No input found, please provide a Dell service tag"
exit 1
fi
# Non-standard shell tools we need
#! /bin/bash
# Simple function to keep in your bashrc to lookup dependencies of a package
# in RHEL/CentOS/Fedora or other similair distributions.
#
# Based on commands from this email thread:
# http://lists.centos.org/pipermail/centos/2006-May/022778.html
yum-pkg-depends ()
{
PACKAGE_NAME=$1
@iamtew
iamtew / build-rpm
Created April 17, 2014 14:37
Simple script to build rpm package with FPM
#! /bin/bash
#
# Simple script to build rpm package with FPM
#
# How to use:
# 1. Create package directory to hold all files, like: ~/src/<package>
# 2. Copy this script, build-rpm, to package directory
# 3. Create subdirectory for the buildroot, like: ~/src/<package>/buildroot
# 4. The buildroot directory will act as a chroot, place files and
# and directories in their appropriate target locations

Keybase proof

I hereby claim:

  • I am iamtew on github.
  • I am iamtew (https://keybase.io/iamtew) on keybase.
  • I have a public key whose fingerprint is 6F85 DF1A 6627 9604 EC6D 17E7 8993 5726 6741 0E7D

To claim this, I am signing this object:

@iamtew
iamtew / md2docx.sh
Created August 21, 2014 19:38
Markdown 2 DOCX using Pandoc
#! /usr/bin/env bash
# For some reason not everyone in the office enjoys markdown documents, so here's
# a quick Pandoc converter function to stick in your ~/.bashrc
md2docx ()
{
INPUT=$1
if [[ $INPUT ]]
then
#! /usr/bin/env bash
#
# willie_monit.sh
#
# Crontab script to ensure Willie bot is running :-)
#
# Willi configuration file and PID file
willie_cfg="$HOME/.willie/default.cfg"
willie_pid="$HOME/.willie/willie-default.pid"
@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/
@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 / 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