Skip to content

Instantly share code, notes, and snippets.

@rca
rca / shelltools.sh
Created August 21, 2012 02:26
Semi-useful Shell functions
# Copyright (c) 2004-2008, Roberto Aguilar <berto at chamaco dot org>
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
@rca
rca / mpm_prefork.conf
Created August 25, 2017 21:50
MySQL and Apache configuration on a small DigitalOcean Droplet for a low-traffic Wordpress site
# /etc/apache2/mods-enabled/mpm_prefork.conf
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 3
@rca
rca / Decrapifier.ps1
Created May 4, 2021 15:36 — forked from gvlx/Windows 10 Decrapifier, 1803_1809.ps1
Windows 10 Decrapifier
#Windows 10 Decrapifier 18XX/19XX
#By CSAND
#Mar 01 2021
#
#
#PURPOSE: Eliminate much of the bloat that comes with Windows 10. Change many privacy settings to be off by default. Remove built-in advertising, Cortana, OneDrive, Cortana stuff (all optional). Disable some data collection.
# Clean up the start menu for new user accounts. Remove a bunch of pre-installed apps, or all of them (including the store). Create a more professional looking W10 experience. Changes some settings no longer
# available via GPO for Professional edition. All of this without breaking Windows.
#
#DISCLAIMER: Most of the changes are easily undone, but some like removing the store are difficult to undo. You should use local/group policy to remove the store if you want.
@rca
rca / zfs_install.sh
Last active December 13, 2020 18:23 — forked from Alexey-Tsarev/zfs_install.sh
ZFS 0.8 at Raspberry Pi
#!/usr/bin/env sh
set -e
set -x
ZFS_RELEASE=zfs-2.0-release
# keep track of the current directory
CUR_PWD="$(pwd)"
@rca
rca / gist:1736835
Created February 4, 2012 09:55 — forked from davidszotten/gist:1091866
fabric bash completion
_fab()
{
_fab_commands=$(fab --shortlist)
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=( $(compgen -W "${_fab_commands}" -- ${cur}) )
case "${COMPREPLY}" in
@rca
rca / PythonOnMac.md
Created January 27, 2020 20:42
Setting up Pyhon on a Mac

Installing Python3 on a Mac

Getting a sane Python3 runtime on a Mac can be tedious. The most painless way I have found thus far installing a Python3 package from python.org and, from there, installing two additional packages into the system directory: pip and pipx.

Install Python

Install Python with a package from python.org. This post uses 3.6.8: https://www.python.org/downloads/release/python-368/

At this point, close the current shell and launch a new shell. This will ensure you have Python 3.6 in your PATH; you should see something similar to:

@rca
rca / vault-env
Created August 29, 2019 18:26
Converts key/value pairs returned by a vault command into environment variables
#!/usr/bin/env python3.6
"""
Converts key/value pairs returned by a vault command into environment variables
"""
import json
import sys
KEY_MAP = {
'access_key': 'AWS_ACCESS_KEY_ID',
'secret_key': 'AWS_SECRET_ACCESS_KEY',
@rca
rca / flush_dns
Created February 5, 2019 15:44
Flushes local DNS cache on MacOS X
#!/bin/bash
set -e
sudo killall -HUP mDNSResponder
@rca
rca / rancher-exec
Created January 25, 2019 16:01
Execute a command within a container running in Rancher k8s
#!/bin/bash
set -e
set -x
SCRIPT_NAME=$(basename $0)
if [ -z "$4" ]; then
echo "${SCRIPT_NAME} <env> <namespace> <pod name> <command> [args]" 1>&2
exit 1
fi;
class Foo:
def __init__(self, x=[]):
self.x = x
f = Foo()
f.x.append(1)