Skip to content

Instantly share code, notes, and snippets.

@andrewmackett
andrewmackett / rds_download_log.py
Created April 22, 2020 14:54 — forked from joer14/rds_download_log.py
Ghetto workaround for downloading rds logs via the AWS REST interface. This uses the IAM credentials for the session so should 'just work' on a lambda without needing to hardcode credentials/pass them in via environmental variables etc.
"""
Craft a web request to the AWS rest API and hit an endpoint that actually works but isn't supported in the CLI or in Boto3.
Based on this: https://github.com/aws/aws-cli/issues/2268#issuecomment-373803942
"""
import boto3
import os
import sys, os, base64, datetime, hashlib, hmac, urllib
import requests
@spyzhov
spyzhov / Dockerfile
Last active December 19, 2024 17:10
Build Golang application in Dockerfile, with private repositories in dependencies, without experimental features.
# NB! not for production!
# https://docs.docker.com/engine/reference/builder/#arg
# Warning: It is not recommended to use build-time variables for passing secrets like github keys, user credentials etc. Build-time variable values are visible to any user of the image with the docker history command.
FROM golang:1.13 as builder
# This argument should be defined as your personal access tokens, from: https://github.com/settings/tokens
ARG GITHUB_ACCESS_TOKEN
# Any kind of configurations:
ENV GO111MODULE=on
@IanColdwater
IanColdwater / twittermute.txt
Last active April 14, 2025 16:31
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@koshatul
koshatul / README.md
Last active May 7, 2025 14:29
use Apple Keychain to store GPG Passphrases

gpg-agent setup

Need to setup gpg-agent first, on OSX I use keychain (it also does ssh-agent)

$ brew info keychain
keychain: stable 2.8.5
User-friendly front-end to ssh-agent(1)
https://www.funtoo.org/Keychain
/usr/local/Cellar/keychain/2.8.5 (7 files, 108.5KB) *
@arschles
arschles / keep-cool-with-fans.go
Last active August 19, 2023 10:10
Fan-out and Fan-in with Go
package fans
// this code was inspired by https://talks.golang.org/2012/concurrency.slide#36
//
// it uses the context package (which wasn't available when that presentation was made) instead of a timer to
// do timeouts
import (
"context"
"time"
@sgdan
sgdan / gzip.kts
Last active March 15, 2025 21:03
Kotlin code to compress/uncompress a string with gzip
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun gzip(content: String): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(content) }
return bos.toByteArray()
@troyfontaine
troyfontaine / 1-setup.md
Last active May 9, 2025 22:20
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

-- 100 million INSERTs benchmark
-- stock PostgreSQL 9.6 setup running on an Ubuntu 16.04 workstation
-- PK TYPE INSERT* time (ms) Relative time AVG throughput (op/s)
------------------------------------------------------------------------
-- BIGSERIAL 242,849.46 1.00 411,777.73
-- UUID COMB 337,028.15 1.39 296,711.12
-- UUID 1 470,385.37 1.94 212,591.65
-- UUID 4 7,808,502.45 32.15 12,806.55
------------------------------------------------------------------------
@ldez
ldez / gmail-github-filters.md
Last active April 16, 2025 20:12
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
cd /Library/Preferences
sudo rm com.sophos.sav.plist
--or--
sudo rm com.sophos.*

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer --force_remove

Sometimes the Sophos virus can exist in the /Library/Application.../Sophos/saas folder