Skip to content

Instantly share code, notes, and snippets.

View admwrd's full-sized avatar

Adam Ward admwrd

  • Los Angeles, CA, USA
View GitHub Profile
PostgreSQL Type PostgreSQL Size Description Range Diesel Type Rust Type
Nullable Types nullable Nullable``
@admwrd
admwrd / worker.js
Last active August 5, 2020 10:36 — forked from maxkostinevich/worker.js
Serverless Geolocation Service
/*
* Serverless Geolocation via Cloudflare Workers.
*
* Idea originally from blog https://maxkostinevich.com/blog/serverless-geolocation
*
* Tested and working on deployed Cloudflare worker.
*
* Code Authors, Contact and Ownership/License
* 1. Marius. (https://gist.github.com/maephisto/9228207) © 2014. License Unknown.
* 2. Max Kostinevich. (https://maxkostinevich.com) © 2020. License Unknown.
@admwrd
admwrd / rocketguide.md
Created September 11, 2017 05:06 — forked from belst/rocketguide.md
Deploy Rocket in production

Deploy Rocket using Letsencrypt and nginx

Information

This guide uses the domain your-domain.tld and its www. prefixed version. It starts the rocket application on 127.0.0.1:1337 and as the user www-data. The proxy listens on port 80 and 443 though.
If you need other values, update them accordingly in your nginx and systemd configs.

Prerequisites

You need to have nginx, certbot and rust installed.

Keybase proof

I hereby claim:

  • I am admwrd on github.
  • I am crab (https://keybase.io/crab) on keybase.
  • I have a public key whose fingerprint is 7E90 E284 D74A A114 747A 499A 6728 9194 01C0 065E

To claim this, I am signing this object:

@admwrd
admwrd / countneedles.py
Created February 22, 2015 03:12
Find Word Occurances in String
def findcount(needle, haystack):
import re
return sum(1 for _ in re.finditer(r'\b%s\b' % re.escape(needle), haystack.lower().replace(r'[a-zA-Z]',' ')))
@admwrd
admwrd / mirrorword.py
Created February 22, 2015 03:11
Word mirror
def flippy(word):
newword = ''
for i in range(0,len(word)):
newword += word[(i+1)*-1]
return newword
@admwrd
admwrd / palindrome.py
Created November 16, 2014 04:18
MB character Palindrome check. Does not work
#! env python3
names = ['Julio', 'racecar', 'umbrella', 'Madam', u'すます', u'😃😜😞😜😃', u'😃😜😞😜']
def pali(word):
#word = alphaonly(word).lower()
print(word+"?")
for i in range(0,(int)(len(word)/2)+1):
if word[i] is not word[(i+1)*-1]:
print(word[i]+", "+word[(i+1)*-1]+" do not match.")