Skip to content

Instantly share code, notes, and snippets.

@dastergon
dastergon / ec2_info_retriever.py
Last active October 11, 2024 16:44
A basic boto3 based tool for retrieving information from running EC2 instances.
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')
@omz
omz / Pythonista Theme Editor.py
Last active August 8, 2023 14:42
Pythonista Theme Editor.py
# coding: utf-8
'''
Basic theme editor for Pythonista 1.6 (beta)
WARNING: Use at your own risk! User themes aren't "officially" supported, and
this may break in future versions. If you enter invalid JSON or anything else
that the app can't deal with, it *will* crash -- your input is not validated
in any way.
'''
@aaronzirbes
aaronzirbes / make-time-machine-work.sh
Last active August 25, 2016 19:45
Script to setup SMB share for time machine backup
#!/bin/bash
###
### This is the script I use to setup time machine to work with my LinkSys attched NAS (USB 3.0 Hard Drive)
###
#### Configurable Parameters #########
SIZE=300g
NAME="Z.org Time Machine Backup"
@santtu
santtu / lambda-downscale-example.js
Created April 24, 2015 21:13
Example of an AWS Lambda function implementing a custom termination policy for auto scale group
console.log('Loading function');
var minInstances = 1;
var region = 'us-east-1';
var EventEmitter = require("events").EventEmitter;
var aws = require('aws-sdk');
var http = require('http');
@sebsto
sebsto / gist:468670c7c0d5feeade69
Created March 20, 2015 07:53
AWS CLI : discover your service limits from the command line
aws support describe-trusted-advisor-check-result --check-id eW7HH0l7J9 --query 'result.sort_by(flaggedResources[?status!="ok"],&metadata[2])[].metadata' --output table --region us-east-1
@fukawi2
fukawi2 / ghost-test.yml
Created January 28, 2015 00:54
Ansible playbook to test for CVE-2015-0235 ("Ghost")
- hosts: all
sudo: yes
tasks:
- name: copy code
copy: src=ghost.c dest=/tmp/ghost.c mode=400
# obtain above code from https://gist.github.com/koelling/ef9b2b9d0be6d6dbab63
- name: compile code
command: chdir=/tmp
gcc -o ghost-test ghost.c
@lucasdavila
lucasdavila / fixup.txt
Last active December 20, 2023 12:00
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf
@ryanmaclean
ryanmaclean / accept_xcode_license.sh
Last active November 22, 2023 18:26
Accept Xcode License on the Command Line
# Run using "sudo accept_xcode_license.sh"
#
# Solving the OSX Yosemite Xcode Command Line Tools Licensing problem
# for multiple updates in order to script post-install tasks.
# Typical error reads after running "xcode-select --install" when setting up
# Homebrew is: "Agreeing to the Xcode/iOS license requires admin priviledges,
# please re-run as root via sudo"
#
# CREDIT:
# Based on a tip found at http://krypted.com/mac-os-x/licensing-the-xcode-command-line-tools/
@johnpolacek
johnpolacek / .gitconfig
Last active March 8, 2025 22:15
My current .gitconfig aliases
[alias]
recent = "!git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)' | head -n 10"
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status