Skip to content

Instantly share code, notes, and snippets.

View briandeheus's full-sized avatar
🆘

Brian de Heus briandeheus

🆘
View GitHub Profile
@briandeheus
briandeheus / megumi.py
Created July 15, 2019 13:40
My daughters first code
# Names of herself and her friends
names = [
'megumid.',
'anna',
'kana'
]
for name in names:
print('Hello', name)
@briandeheus
briandeheus / reset-migrations.sh
Created June 22, 2019 07:48
Reset your Django migrations the cool way
#!/usr/bin/env bash
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
python manage.py makemigrations
python manage.py migrate
import yaml
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str, default='settings.yaml')
args = parser.parse_args()
__settings = yaml.safe_load(open(args.config, 'r'))
@briandeheus
briandeheus / parcel-react.sh
Created March 6, 2019 08:49
Parcel + React + Sass setup script
#!/bin/bash
package_json='
{
"name": "frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"""
This is a good way of using Call/Report.
"""
class Call(object):
def get(self, url):
return requests.get(url)
class Report(object):
@briandeheus
briandeheus / example.py
Last active February 14, 2018 10:02
How to properly use attributes in Python
class FaultyFoo (object):
bar = []
class GoodFoo (object):
def __init__(self):
self.bar = []
@briandeheus
briandeheus / useragents.txt
Created December 1, 2017 03:59
9400+ User Agents!
Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)
Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)
Mozilla/5.0 (compatible; ABrowse 0.4; Syllable)
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser 1.98.744; .NET CLR 3.5.30729)
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser 1.98.744; .NET CLR 3.5.30729)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; Acoo Browser; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Avant Browser)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser; GTB5; Mozilla/4.0 (comp

If effective strategy requires realistic aims, then America is in trouble. US officials have shown themselves to be pathologically overconfident in their ability to achieve political outcomes with military signals, and the outcome they’re trying to achieve is utterly unrealistic.

Imagine if the US flew what North Korea thought were nuclear-capable bombers up near its border, sporadically at first, then once per month. Then twice per month. In parallel, the US starts sending nuclear-capable submarines to port in South Korea. Then it issues warning orders to US Navy surface ships armed with Tomahawk land-attack cruise missiles (the kind used against Syria in April) to program North Korean targets while patrolling in waters off North Korea’s eastern coast. Then it deploys fifth-generation stealth fighters to Japan in conjunction with the arrival of three aircraft carriers to the Pacific.

What do these military preparations look like?

Now imagine that the political rhetoric coinciding with all these mili

@briandeheus
briandeheus / message_queue.py
Created September 5, 2017 14:09
Distributed Message Queue in Python
from redis import Redis
import time
redis = Redis()
def work_from_queue(queue):
while True:
res = redis.rpop(queue)
@briandeheus
briandeheus / chronos-simple.py
Created September 22, 2016 04:30
Chronos Simple Service
from time import sleep
from lib import *
import signal
if __name__ == '__main__':
signal.signal(signal.SIGTERM, handle_sigterm)
write_to_file('Starting Chronos')