Skip to content

Instantly share code, notes, and snippets.

View dmreiland's full-sized avatar

Dan Reiland dmreiland

View GitHub Profile
@0xjac
0xjac / private_fork.md
Last active July 18, 2025 20:50
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@johncmckim
johncmckim / package.json
Last active May 1, 2017 17:31
Prune Lambda Functions - PLEASE REVIEW AND USE AT YOUR OWN RISK
{
"dependencies": {
"aws-sdk": "^2.7.10",
"bluebird": "^3.4.6",
"lodash": "^4.17.2",
"moment": "^2.17.1"
}
}
@fideloper
fideloper / stream_file.php
Last active March 15, 2025 03:08
Stream file from S3 to browser, assume Laravel Filesystem usage
<?php
/*************************************************************************
* Get File Information
*/
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';
@szinck
szinck / alb_logs.sql
Created August 13, 2017 02:21
Athena Table for ALB Logs
-- This creates an athena table that can parse ALB logs.
-- Advantage of this over others are this works when the log ends with a trailing space
-- plus it also breaks the http request into route and params for easier grouping
CREATE EXTERNAL TABLE IF NOT EXISTS alb_logs (
type string,
timestamp string,
elb string,
client_ip string,
client_port int,
@alexellis
alexellis / k8s-pi.md
Last active June 28, 2025 05:44
K8s on Raspbian
@adewes
adewes / README.md
Last active August 12, 2024 20:19
Borg Backup - Shell script to create regular backups (can e.g. be called hourly by cron).

Borg Backup Script

This is a little helper script to regulary back up your data using the Borg backup tool. I wrote this as I was frustrated with Deja-Dup, which does not allow me to exclude directories by pattern, hence I ended up with backups that were very large and took a really long time to create because they contained many directories with non-essential files (e.g. node modules or Python virtual environments). Borg backup is a simple tool that offers everything that Deja-Dup does and is easier to customize.

  • Put the script in your home folder and make it executable.
  • Call it regularly using e.g. cron (put e.g. "0 * * * * [your username] /home/[your username]/make_backup.sh" in your /etc/crontab - this will call the script every hour). Please note that the script will perform its own checking to see
@lakshmanok
lakshmanok / census_zip.sql
Created July 19, 2018 21:51
bigquery-gis
#standardsql
with zipcodes as (
SELECT
zip_census.zipcode as zipcode,
population,
WKT as geometry,
ST_CENTROID(ST_GeogFromText(WKT)) as centroid
FROM
`bigquery-public-data.census_bureau_usa.population_by_zip_2010` AS zip_census
join `bigquery-public-data-staging.zcta_test.2017` as zip_geom
@dmreiland
dmreiland / EXCEPT.sql
Created June 13, 2019 14:51 — forked from yancya/EXCEPT.sql
INTERSECT and EXCEPT for BigQuery
#standardsql
WITH a AS (
SELECT * FROM UNNEST([1,2,3,4]) AS n
), b AS (
SELECT * FROM UNNEST([4,5,6,7]) AS n)
SELECT * FROM a
@J-Cake
J-Cake / Track Download Progress in node.js
Created July 9, 2019 13:14
This script records progress made over download without using the `pipe` function and is incredibly memory efficient.
const http = require('http');
const fs = require('fs');
const path = require('path');
const fileLocation = path.join(__dirname, 'video.mp4');
fs.writeFileSync(fileLocation, '');
const file = fs.createWriteStream(fileLocation);
function printSize(bytes) {
@kopwei
kopwei / k3s-cluster.md
Last active December 20, 2024 22:21
K3s and Rancher on Raspberry Pi 4 Cluster

Deploy K3s and Rancher on Raspberry Pi 4 cluster

Today I tried to setup a small Kubernetes cluster on top of 3 Raspberry Pi 4 (4GB Memory). Here is the steps to install the cluster.

IMG_3817

Preparation

I have 3 Raspberry Pi 4 stacked with PoE headers and connected to a PoE switch at home. The are connected to Internet through a home router. All Pis are equipped with a 64GB Samsung SDXC card flushed with Ubuntu 20.04 image.