Skip to content

Instantly share code, notes, and snippets.

View dwin's full-sized avatar
🎯
Focusing

Darwin Smith dwin

🎯
Focusing
View GitHub Profile
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
Function:
Type: AWS::Serverless::Function
Properties:
Handler: handler.Handle
Runtime: python2.7
CodeUri: ../cloudbookmarks.zip
Events:
@dwin
dwin / docker-compose.yml
Created May 11, 2019 00:58 — forked from mhowlett/docker-compose.yml
Brings up a kafka cluster using Docker for Mac. Usage: MY_IP=<your ip> docker-compose up
---
version: '2'
services:
zk1:
image: confluentinc/cp-zookeeper:3.0.1
ports:
- "22181:22181"
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 22181
@josephspurrier
josephspurrier / drop_encrypt.go
Last active March 24, 2020 17:48
Golang - Drag and Drop AES Encryption and Decryption
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
@poweroftrue
poweroftrue / kubernetes_add_service_account_kubeconfig.sh
Last active May 10, 2021 13:31 — forked from xtavras/kubernetes_add_service_account_kubeconfig.sh
create kubernetes service account and corresponding kubeconfig
#!/usr/bin/env bash
# script was taken from https://gist.github.com/innovia/fbba8259042f71db98ea8d4ad19bd708 and adjusted with "apply_rbac" function and colorized output
set -e
set -o pipefail
# Colors
RED="\e[01;31m"
@dwin
dwin / accesslog2csv.pl
Created September 2, 2021 03:07 — forked from sepehr/accesslog2csv.pl
Perl: Convert Apache access log to CSV
#!/usr/bin/perl
#
# @file
# Converter tool, from Apache Common Log file to CSV.
#
# All code is released under the GNU General Public License.
# See COPYRIGHT.txt and LICENSE.txt.
#
@josiahcarlson
josiahcarlson / rate_limit2.py
Last active April 17, 2022 09:22
Regular and sliding window rate limiting to accompany two blog posts.
'''
rate_limit2.py
Copyright 2014, Josiah Carlson - josiah.carlson@gmail.com
Released under the MIT license
This module intends to show how to perform standard and sliding-window rate
limits as a companion to the two articles posted on Binpress entitled
"Introduction to rate limiting with Redis", parts 1 and 2:
@luckydev
luckydev / gist:b2a6ebe793aeacf50ff15331fb3b519d
Last active October 22, 2022 14:03
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@harlow
harlow / worker-pool.go
Last active November 3, 2022 19:52
Worker pool to control concurrency and collect results
package main
import (
"fmt"
"sync"
"time"
)
const concurrency = 3
@twolfson
twolfson / README.md
Last active November 24, 2022 10:28
How to generate secure and reusable scrubbed database dumps

For a while I have wanted to set up reusable scrubbed database dumps like I had at a former employer. While I never learned the specifics, I feel like the gist is still the same. We take the following steps:

  1. Create scrubbed/pruned database within internal network
  2. Upload database to private yet externally accessible location (in our case S3)
  3. Download and install uploaded scrubbed/pruned database for development
    • Guarantees accurate yet non identifiable information

Side note: We also store multiple versions and use a hardcoded file (i.e. latest-version) as a pointer for which to use.

The corresponding scripts are run like this:

@TheGU
TheGU / uploader.go
Created September 11, 2015 10:07
Golang to upload file to google drive with progress bar using Google API
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"