Skip to content

Instantly share code, notes, and snippets.

View tuxpowered's full-sized avatar

TuxPowered tuxpowered

View GitHub Profile
@dmdavis
dmdavis / utc_to_local.py
Created March 20, 2014 18:31
Example of converting UTC to local time using python-dateutil
#!/usr/bin/env python
# encoding: utf-8
"""
utc_to_local.py
Example of converting UTC to local time using python-dateutil.
https://pypi.python.org/pypi/python-dateutil
"""
from datetime import datetime
@ReactiveRaven
ReactiveRaven / gist:9348401
Last active December 16, 2022 18:30
Ubuntu memory tuning

Add these lines to the end of /etc/sysctl.conf:

vm.swappiness=5
vm.min_free_kbytes=122880
vm.vfs_cache_pressure=500

Run these commands as root:

sudo sysctl -w vm.swappiness=5;

sudo sysctl -w vm.min_free_kbytes=122880

@hwdsl2
hwdsl2 / .MOVED.md
Last active September 2, 2025 05:41
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@crashdump
crashdump / check-ssl-expire.py
Last active February 15, 2025 19:16
Report how many days before and http ssl certificate expire. I've also provided a template if you want to use it with Zabbix as an External Check: - Configure ExternalScripts variable in zabbix_server.conf - Put the script in the external script folder (I've used /etc/zabbix/externalscripts/) - Import the template & assign it to your host. - Wat…
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Adrien Pujol - http://www.crashdump.fr/"
__copyright__ = "Copyright 2013, Adrien Pujol"
__license__ = "Mozilla Public License"
__version__ = "0.3"
__email__ = "adrien.pujol@crashdump.fr"
__status__ = "Development"
__doc__ = "Check a TLS certificate validity."
@erikw
erikw / snp
Last active September 14, 2025 23:42
snp: Wrap shell command in BTRFS snapper pre-post snapshots and log outputs.
#!/usr/bin/env bash
# Runs a command wrapped in btrfs snapper pre-post snapshots.
# Usage: $ snp <commands>
# e.g.: $ snp pacman -Syyu
# Requirements: snapper (https://wiki.archlinux.org/title/snapper)
# The latest version of this script is hosted at https://gist.github.com/erikw/5229436
log_path="/var/local/log/snp"
date=$(date "+%Y-%m-%d-%H%M%S")
log_file="${log_path}/snp_${date}.log"
@farproc
farproc / download_all_lj.sh
Created January 3, 2013 18:25
Little bash script to download all the linux journal issues from a subscription.
#!/bin/bash
#
# warning: this isn't pretty or good in anyway, but it worked for me...
#
ACCOUNT="LJ123456"
# remember to URL encode the zip (%20 instead of space etc.)
ZIP="123456"
for u in `curl -vvv "http://download.linuxjournal.com/pdf/dljdownload.php?AN=${ACCOUNT}&ZP=${ZIP}" |grep a\ href | grep get\-doc | sed 's/^.*href\=\"//g' | sed 's/\".*$//g'`
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred
@JeffPaine
JeffPaine / us_state_abbreviations.py
Last active November 27, 2025 20:16
A python list of all US state abbreviations.
# United States Postal Service (USPS) abbreviations.
abbreviations = [
# https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#States.
"AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "IA",
"ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO",
"MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK",
"OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA", "WI",
"WV", "WY",
# https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States#Federal_district.
"DC",
@egradman
egradman / gist:1505388
Created December 21, 2011 09:34
tropo python webapi coroutines
import tropo
coroutines = {}
def prompt_text(self, prompt, number):
"""
initiate a conversation with <phone>, asking a prompt
(merely pings the outbound session endpoint)
"""
@tmiz
tmiz / build_openssl_dylib.sh
Last active September 23, 2025 16:13
Build latest OpenSSL Universal Binary on OSX
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386