Skip to content

Instantly share code, notes, and snippets.

Darin Dowwie

Block or report user

Report or block Dowwie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Dowwie
Dowwie / instructions.md
Created Apr 8, 2019 — forked from harding/instructions.md
Working With Multiple Repositories On GitHub
View instructions.md

Working With Multiple Repositories On GitHub

Most projects on GitHub have a main repository that's the focal point of activity. For example, the Example organization has the Example.com repository:

https://github.com/example/example.com

Developers of Example.com typically call this the 'upstream' repository. We'll come back to it in a moment.

@Dowwie
Dowwie / letsencrypt_2018.md
Created Jun 21, 2018 — forked from cecilemuller/letsencrypt_2019.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2018.md

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

View gist:59f70e82fcd8cc109321e2bac77936b3
[dependencies]
serde = "1.0.27"
serde_derive = "1.0.27"
serde_json = "1.0.9"
serde_yaml = "0.7.3"
diesel = { version = "1.1.1", features = ["postgres"] }
r2d2 = "0.8.2"
r2d2-diesel = "1.0.0"
@Dowwie
Dowwie / wtd_choices.py
Last active Jan 10, 2018
As of Python3.6, random.choices offers weighted choices
View wtd_choices.py
age_groups = [lambda: random.randint(18,25),
lambda: random.randint(25,40),
lambda: random.randint(40,90)]
age_group_probs = [.5, .3, .1]
def get_choices():
pop_choices = random.choices(age_groups, weights=age_group_probs, k=10)
population = list(map(lambda x: x(), pop_choices))
@Dowwie
Dowwie / bench_maplit_hash.rs
Last active Jan 8, 2018
bench_maplit_hash.rs
View bench_maplit_hash.rs
#![feature(test)]
extern crate test;
#[macro_use] extern crate bencher;
#[macro_use] extern crate maplit;
use test::Bencher;
use std::collections::HashSet;
fn test_maplit() -> HashSet<&'static str> {
@Dowwie
Dowwie / working_with_pg_time.py
Last active Jun 9, 2017
A Python implementation of Craig Kerstiens's blog post, "Working with Time"
View working_with_pg_time.py
"""
This is a python implementation of Craig Kerstiens blog post:
http://www.craigkerstiens.com/2017/06/08/working-with-time-in-postgres/
"""
from random import randint
import functools
from datetime import datetime
import numpy as np
from arrow import Arrow
@Dowwie
Dowwie / fast.md
Created Jan 27, 2017 — forked from hemanth/fast.md
Guido van Rossum's Tips for fast Python
View fast.md

Guido van Rossum11 Sep 2012 - Public

Some patterns for fast Python. Know any others?

  • Avoid overengineering datastructures. Tuples are better than objects (try namedtuple too though). Prefer simple fields over getter/setter functions.

  • Built-in datatypes are your friends. Use more numbers, strings, tuples, lists, sets, dicts. Also check out the collections library, esp. deque.

  • Be suspicious of function/method calls; creating a stack frame is expensive.

@Dowwie
Dowwie / authz.go
Created Jan 21, 2017
experimenting with refactoring yosai permission authorization checks using Go
View authz.go
package main
import (
"C"
"fmt"
"strings"
"gopkg.in/fatih/set.v0"
)
type Permission struct {
@Dowwie
Dowwie / main.py
Last active Jan 18, 2017
Experimenting with refactoring permission authorization with a Rust implementation (thus far, a Rust integration is slower)
View main.py
# works for python 2.7
import ctypes
import timeit
rustLib = "./libauthz.so"
assigned_perms = ["domain1:action3:target1", "domain1:action1,action2", "domain1:action4:target2"]
required_perm = "domain1:action4:target3"
def testRust():
View keybase.md

Keybase proof

I hereby claim:

  • I am dowwie on github.
  • I am dowwie (https://keybase.io/dowwie) on keybase.
  • I have a public key ASCP2ZdSKPFGdm0BB6qVpYSEy4MYa8s29VooXlJn-9gnSgo

To claim this, I am signing this object:

You can’t perform that action at this time.