Skip to content

Instantly share code, notes, and snippets.

\documentclass[11pt,a4paper]{article}
% Declare the new flag
\newif\ifspanish
% To set the flag, now you use:
% \spanishtrue
% \spanishfalse
% To check the value, the construct is
% \ifspanish
% Value if true
# Install the necessary VLAN packages and configuration
# Install package
sudo apt-get install -y vlan
# Load the kernel module
sudo modprobe 8021q
# Add the module to load at system boot (If it isn't already)
grep '^8021q$' /etc/modules 2>/dev/null 1>&2 || sudo sh -c 'echo "8021q" >> /etc/modules'
echo "I recommend rebooting"
@wynro
wynro / secure_sshd.sh
Last active November 10, 2017 13:20
Secure a new installation of ssh in Ubuntu (checked in 14.04 and 16.04)
# Remember to copy your public key to the server (ssh-copy-id) before executing this, or you'll lose access to it.
# Also, be sure to either execute a command with sudo before (something like 'sudo ls' is enough) to prevent sudo asking for the password on every command
sudo sed -i 's/PermitRootLogin .*/PermitRootLogin no/' /etc/ssh/sshd_config
sudo sed -i 's/#PermitEmptyPasswords .*/PermitEmptyPasswords no/' /etc/ssh/sshd_config
sudo sed -i 's/#PasswordAuthentication .*/PasswordAuthentication no/' /etc/ssh/sshd_config
# Remember to add an AllowUsers clause, with the correct users and network. Example:
# sudo sh -c 'echo "AllowUsers you@192.168.0.0/16" >> /etc/ssh/sshd_config
IMAGE_X_SIZE=483
IMAGE_Y_SIZE=511
OFFSET=5
convert -define jpeg:size="$(( $IMAGE_X_SIZE - $OFFSET))x$(( $IMAGE_Y_SIZE - $OFFSET))" base.jpg[$(( $IMAGE_X_SIZE - $OFFSET))x$(( $IMAGE_Y_SIZE - $OFFSET))+0+0] animate-0.jpg
convert animate-0.jpg -page +0+0 lettering.png -flatten animate-0.jpg
convert -define jpeg:size="$(( $IMAGE_X_SIZE - $OFFSET))x$(( $IMAGE_Y_SIZE - $OFFSET))" base.jpg[$(( $IMAGE_X_SIZE - $OFFSET))x$(( $IMAGE_Y_SIZE - $OFFSET))+0+$OFFSET] animate-1.jpg
convert animate-1.jpg -page +0+0 lettering.png -flatten animate-1.jpg
@wynro
wynro / random-man.py
Last active January 14, 2017 00:26
Gets you a random man. Remember, a man a day keeps the doctor away!
#!/usr/bin/env python
"""
Returns a random command's manpage
Author: Guillermo Robles
"""
import commands
import random
import os