Skip to content

Instantly share code, notes, and snippets.

View tomislacker's full-sized avatar

Ben Tomasik tomislacker

View GitHub Profile
@tomislacker
tomislacker / freenas_fun.md
Created December 24, 2014 03:45
freenas fun

FreeNAS Fun

About

@TODO

Operations

Get CPU Temps

sysctl -a |egrep -E "cpu\.[0-9]+\.temp"
@tomislacker
tomislacker / php_predefined_classes.md
Last active June 11, 2020 18:40
PHP Pre-Defined Classes

PHP Pre-Defined Classes

This gist was something I did quickly in order to see what other built-in exception types I could throw.

PHP Version

PHP 5.4.36-pl0-gentoo (cli) (built: Dec 29 2014 22:12:26) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
@tomislacker
tomislacker / example.md
Last active January 18, 2018 01:33
iproute2 is awesome

iproute2 is Awesome

Today I learned about the ip route list [table TABLE] subcommand. I have always used ip route show [table TABLE] in the past but recently found the need/desire for better "queryability" of the routes.

At face value, both list and show look identical. Example:

$ ip route list table local
@tomislacker
tomislacker / periodic-fstrim.sh
Created August 25, 2015 18:08
Periodic FS Trim Script
#!/bin/bash
LAST_RUN_FILE=/var/fstrim.lastrun
MINIMUM_TIME=$((12*60*60))
PARTITIONS=( \
"/" \
)
currentTime=$(date +%s)
@tomislacker
tomislacker / resolve_all_ips.py
Created September 16, 2015 17:25
Resolve all IP's from RR DNS with Python
import dns.resolver
answer = dns.resolver.query('www.google.com', 'A')
for a_record in answer.rrset.items:
print "- {}".format(str(a_record))
##########
# OUTPUT #
##########
@tomislacker
tomislacker / iptc_and_imq.py
Last active October 2, 2015 22:00
Using python-iptables to setup IMQ
import iptc
WAN_IFACE = "eth1"
IMQDEV_IN = 0
IMQDEV_OUT = 1
def get_available_imq():
pass
def get_imqdev(wan_iface, direction):
@tomislacker
tomislacker / 2015.10.21_alembic_primer.md
Last active September 11, 2018 15:03
2015.10.21 Alembic Primer
@tomislacker
tomislacker / never-buy-samsung-t1.md
Last active September 4, 2018 20:45
Do Not Buy: Samsung T1 SSD
@tomislacker
tomislacker / 2016.01.07_bash_oddity.md
Created January 7, 2016 15:49
2016.01.07 - Bash Oddity

2016.01.07 - Bash Oddity

Example Script

#!/bin/bash

is_integer ()
{
 [[ $@ =~ ^-?[0-9]+$ ]] || return 1
@tomislacker
tomislacker / aws-iam-policy-for-users-access-keys-and-mfa.md
Created January 26, 2016 15:07
AWS IAM - Allow Users to Manage Their Own Access Keys & MFA Tokens

Overview

By default, AWS accounts are not allowed to add/remove their own access keys or multi-factor authentication tokens. To empower some of your users, you may be interested in adding a policy to allow them to do so.

The Policy

I've named mine UsersManageOwnMFA-and-access-tokens and replaced my account