Skip to content

Instantly share code, notes, and snippets.

View gekitsuu's full-sized avatar
🏠
Working from home

Adam Glenn gekitsuu

🏠
Working from home
View GitHub Profile
#!/bin/bash
# I wanted a script to pull secrets from 1Password and use them
# to perform a backup with restic. Putting this up as an example
# in case it's useful to other people. This script expects a
# file in your $HOME named .restic_excludes.txt which will
# allow you to list paths you want to skip
export AWS_ACCESS_KEY_ID="op://vault/AWS S3/username" # AWS IAM Cred from 1Password
export AWS_SECRET_ACCESS_KEY="op://vault/AWS S3/credential" # AWS IAM Cred from 1Password
@gekitsuu
gekitsuu / finde_dupes.py
Created June 5, 2021 22:58
Python script to find duplicate files in directory and it's child directories
from rich import print
import pathlib
import hashlib
import pprint
# Simple script to hash a diretory and it's subdirectories to see if there are any dupes
# Here's an example awk to take the output report and get the first match in each of the duplicate files found
#
# awk '/hash matched/ { getline ; print $0 }'
@gekitsuu
gekitsuu / error_handler.py
Created February 13, 2019 21:42
Decorator to retry on exceptions
import time
import logging
from functools import wraps
def retry_errors(exceptions, timeout=300, wait_time=10):
"""Catch exceptions and retry until the timeout is reached.
exceptions: An Exception object or tuple of exception objects.
timeout: Integer, defaults to 300 seconds. Time to attempt call before failing.
@gekitsuu
gekitsuu / wipes.py
Created December 10, 2018 17:56
Fun with Eyeglass wipes
"""
I order https://www.amazon.com/Zeiss-Pre-Moistened-Cleaning-Wipes-count/dp/B01E9NC2Z4/ref=sr_1_3_a_it?ie=UTF8&qid=1544464237&sr=8-3&keywords=zeiss+wipes
from Amazon pretty regularly.
The packets come with 2 attached together. When I pull one out that's still 2
attached, I tear off one of them to use and put the other back in the box.
I wanted to know how many times I have to pull a packet from the box before
I am more likely to pull a single packet instead of a double.
An example of how to run this is
@gekitsuu
gekitsuu / IT Questions
Last active December 25, 2017 06:18
it_questions.txt
##########################################################
# Question 1 #
##########################################################
# What will the output of the following be?
for x in $(seq 1 10);do
echo $x;
done
##########################################################
# -*- mode: ruby -*-
# vi: set ft=ruby :
$attacker_script = <<SCRIPT
# Add "firewall" as the default gateway
route add default gw 192.168.102.10
# Make the above step persist across reboots
echo " gateway 192.168.102.10" >> /etc/network/interfaces
SCRIPT
### Keybase proof
I hereby claim:
* I am gekitsuu on github.
* I am gekitsuu (https://keybase.io/gekitsuu) on keybase.
* I have a public key whose fingerprint is ABA4 1406 510C EA49 1E3B 20DF 7D33 A1FE F23C D61E
To claim this, I am signing this object:
@gekitsuu
gekitsuu / setup_my_mac.sh
Last active February 25, 2019 20:54
Setup a new mac
#!/bin/bash
# Author: Adam Glenn
# Email : gekitsuu@gmail.com
#
# To update this Gist run
# gist --login # if not already logged in
# gist -u e3dd4378878c1e7ec7f62e2d04d50884 ./setup_my_mac.sh
install_homebrew(){
@gekitsuu
gekitsuu / deploy_script.py
Created July 5, 2012 12:03
Deploy ZombieTracker to Rackspace using Libcloud
from gevent import monkey
from libcloud.compute.deployment import MultiStepDeployment
from libcloud.compute.deployment import ScriptDeployment
from libcloud.compute.deployment import SSHKeyDeployment
import gevent
import json
import libcloud.security
import libcloud.compute.providers
import libcloud.compute.types