Skip to content

Instantly share code, notes, and snippets.

View excenter's full-sized avatar

Andrew Batz excenter

View GitHub Profile
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@theburningmonk
theburningmonk / janitor-lambda.js
Last active September 29, 2021 14:36
Janitor Lambda function
'use strict';
const _ = require('lodash');
const co = require('co');
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda({ apiVersion: '2015-03-31' });
let functions = [];
let listFunctions = co.wrap(function* () {
@nmarley
nmarley / dec.py
Last active March 6, 2025 11:56
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)
@NeuroWinter
NeuroWinter / ffmpeg cheatsheet for glitching
Last active March 7, 2026 19:49
ffmpeg cheatsheet for glitching
FFMPEG '-i', file, '-c:v', 'libopenjpeg', "jpeg2000\\" + name + ".jp2"\
Convert image to jpeg2000
ffmpeg -i in.png -c:v libopenjpeg out.jp2
Hex Edit out.jp2
ffmpeg -i in.jp2 -c:v png out.png
General Edit
ffmpeg -i input.avi -c:v mpeg2video -g 999 -q:v 1 output.avi
*edit in avidemux/whatever*
#!/usr/bin/python
# Credit to frogor for the objc
from Foundation import NSBundle
import json
import objc
import os
import plistlib
import subprocess
@subfuzion
subfuzion / dep.md
Last active July 25, 2024 03:38
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@posener
posener / go-shebang-story.md
Last active February 4, 2026 23:55
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

@siklodi-mariusz
siklodi-mariusz / Dockerfile
Created January 30, 2018 19:40
Dockerfile example for Ruby on Rails running on Alpine Linux
FROM ruby:2.4-alpine3.7
# Install dependencies:
# - build-base: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - postgresql-dev postgresql-client: Communicate with postgres through the postgres gem
# - libxslt-dev libxml2-dev: Nokogiri native dependencies
# - imagemagick: for image processing
RUN apk --update add build-base nodejs tzdata postgresql-dev postgresql-client libxslt-dev libxml2-dev imagemagick
import boto3
def creation_table_scaling(table_name: str, key_name: str, key_type: str, max_read_capacity: int, max_write_capacity: int):
"""
Create table dynamodb and make it scale then wait for it to be created
Args:
table_name (str): the name of the table to create
key_name (str): the name of the key, and main attribute of the table
key_type (str): the data type for the attribute, S for string, N for number, B for binary
max_read_capacity(int) : Max nb of read per minute
@excenter
excenter / grab_complete_node.py
Created March 18, 2019 03:35
py2neo cheat sheet
from py2neo import Graph, Node, Relationship
graph = Graph(
host="alpha.graph.domain.co",
auth=('neo4j', 'thePassword-butBetter')
)
url="https://py2neo.org/v4/database.html#py2neo.database.Graph.delete_all"
a = Node("Type", url=url)
graph.merge(a, "Website", "url")