Skip to content

Instantly share code, notes, and snippets.

View ns-mkusper's full-sized avatar
👋

Mark Kusper ns-mkusper

👋
  • Chicago
View GitHub Profile
@robinkraft
robinkraft / s3bucketsize.py
Last active October 24, 2021 11:43
Simple python script to calculate size of S3 buckets
import sys
import boto
# based on http://www.quora.com/Amazon-S3/What-is-the-fastest-way-to-measure-the-total-size-of-an-S3-bucket
# assumes you've already configured your access id & secret key
s3 = boto.connect_s3()
@KartikTalwar
KartikTalwar / Documentation.md
Last active May 9, 2024 12:59
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@justinhj
justinhj / git-add-dired.el
Created July 7, 2013 21:28
Allows you to use dired to add multiple files to a git repository. This is useful since staging files in magit is sluggish and takes a long time when you have a lot of files.
(defun git-add-files(files)
"Run git add with the input file"
(interactive)
(shell-command (format "git add %s" files)))
(defun dired-git-add-marked-files()
"For each marked file in a dired buffer add it to the index"
(interactive)
(if (eq major-mode 'dired-mode)
(let ((filenames (dired-get-marked-files))
@drmalex07
drmalex07 / TestSkipValidation.java
Last active November 2, 2023 17:10
Create a new Java keystore. Add your trusted certificates. #java #jks #certificate #ssl #keystore
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.BufferedReader;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
@nezihyigitbasi
nezihyigitbasi / presto-rest.md
Last active September 14, 2021 11:54
Presto REST Services

/v1/node
/v1/node/failed
/v1/execute
/v1/statement
/v1/query
/v1/query/{query_id}
/v1/thread
/ui/thread
/v1/task
/v1/task/{task_id}

@fasiha
fasiha / csv2sql.sh
Last active July 30, 2021 09:20
Dump the contents of an Anki collection.anki2 SQLite database to a bunch of CSV files (one for each table)
#!/bin/bash
# USAGE: csv2sql.sh NO_HEADER.csv TABLE_NAME
# Delete all rows from TABLE_NAME and import NO_HEADER.csv into it.
sqlite3 collection.anki2 <<EOF
DELETE FROM $2;
.mode csv
.import $1 $2
EOF
@popravich
popravich / PostgreSQL_index_naming.rst
Last active March 25, 2024 12:42
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@subfuzion
subfuzion / curl.md
Last active May 9, 2024 18:17
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@olih
olih / jq-cheetsheet.md
Last active May 9, 2024 19:35
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@maxvt
maxvt / infra-secret-management-overview.md
Last active February 28, 2024 20:53
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.