Skip to content

Instantly share code, notes, and snippets.

View dwin's full-sized avatar
🎯
Focusing

Darwin Smith dwin

🎯
Focusing
View GitHub Profile
@dwin
dwin / .bash_profile
Last active December 2, 2016 03:17 — forked from josephspurrier/.bash_profile
OS X Bash Profile
#################################################################################
#
# Bash Configurations and Aliases for OS X
#
# Latest: https://gist.github.com/00000
#
################################################################################
################################################################################
# Terminal
@dwin
dwin / coin_toss.py
Created December 24, 2016 01:47
Basic Coin Toss in Python
import random
heads = 0
tails = 0
def flipResult():
random_num = random.random()
rounded = round(random_num)
if rounded == 0:
return 0
@dwin
dwin / Caddyfile
Created March 15, 2017 19:11
Caddy Server configuration file
# Standard HTML site using Git plugin with Github.com
website.com {
tls email@website.com
gzip
root /srv/website.com/public
ext .html .htm
git {
repo git@github.com:dddd/Amber.git
key /srv/website.com/.ssh/id_rsa
hook /webhook github_idkey # set github request type to json
@dwin
dwin / Caddyfile_TLS
Created August 16, 2017 15:31
Caddyfile TLS Ciphers
Cipher Suites
The following cipher suites are currently supported: (as of 2017-08-16)
ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-WITH-CHACHA20-POLY1305 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-WITH-CHACHA20-POLY1305 ECDHE-RSA-AES256-CBC-SHA ECDHE-RSA-AES128-CBC-SHA ECDHE-ECDSA-AES256-CBC-SHA ECDHE-ECDSA-AES128-CBC-SHA RSA-AES256-CBC-SHA RSA-AES128-CBC-SHA ECDHE-RSA-3DES-EDE-CBC-SHA RSA-3DES-EDE-CBC-SHA
@dwin
dwin / Search.java
Last active August 18, 2017 02:09
Sequential vs Jump Search Algoritm for finding key digits in sorted numerical array
/*
* Dwin
*
*/
// Search ordered numerical array for specified numerical keys
public class Search {
static int[] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 19, 21, 25, 28, 31, 34, 36, 37, 38, 43, 49, 52, 53, 55, 60, 66, 69, 72, 81, 89, 110, 115, 116, 123, 144, 167, 182, 199, 233, 302, 320, 377, 462, 510, 540, 610, 630, 641, 666, 671, 695, 713, 715, 732, 754, 769, 856, 875, 900, 905, 915};
static int[] key = {0, 16, 116, 302, 610, 666, 900};
public static void main(String[] args) {
@dwin
dwin / keybase.md
Last active July 2, 2018 20:32
Keybase Proof

Keybase proof

I hereby claim:

  • I am dwin on github.
  • I am dwins (https://keybase.io/dwins) on keybase.
  • I have a public key ASCJnQAtZ0puYoFAd2rVUy8UJamdLxRHLv1yqjyL7Tyoago

To claim this, I am signing this object:

@dwin
dwin / drone.yml
Created January 11, 2019 18:26
Drone Secrets Definition
test:
image: golang:alpine
secrets:
- source: token
target: TOKEN
environment:
# TOKEN:
commands:
- apk add --update bash ca-certificates build-base
@dwin
dwin / generate_random_string.go
Last active February 14, 2019 21:51
Generate Random String in Go
//
// Do Use This the generated string is not very random at all
//
package main
import (
"fmt"
"math/rand"
"time"
)
@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
@dwin
dwin / linux free disk space.txt
Created July 21, 2020 02:35
Get Free Disk Space Linux excluding tmp directories
df -h -x tmpfs -x devtmpfs