Skip to content

Instantly share code, notes, and snippets.

View rj76's full-sized avatar

Richard Jansen rj76

  • The Hague, The Netherlands
View GitHub Profile
@rj76
rj76 / run_tests.sh
Created July 26, 2016 16:42
play wav on tests failure/success
#/bin/bash
success="/home/richard/Downloads/computer_systems.wav"
fail="/home/richard/Downloads/go_back_to_work.wav"
./manage.py test --settings settings.test_settings
if [ $? -ne 0 ]; then
vlc --play-and-exit --quiet --intf dummy vcd:// $fail
else
vlc --play-and-exit --quiet --intf dummy vcd:// $success
@rj76
rj76 / run_tests.sh
Last active July 28, 2016 09:07
Run Django tests and let espeak playout the result
#/bin/bash
convertsecs() {
((h=${1}/3600))
((m=(${1}%3600)/60))
((s=${1}%60))
printf "Tests took %02d hours, %02d minutes, %02d seconds...\n" $h $m $s
}
env python manage.py test --settings settings.test_settings $1 2> logs/test_stderr.log
@rj76
rj76 / index.andriod.jsx
Created March 7, 2017 09:25
basic test
import 'react-native';
import React from 'react';
import Index from '../index.android.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
@rj76
rj76 / demovibes.md
Created July 28, 2015 06:12
Demovibes source cleanup

I looked at the existing codebase and taking into account my experiences with previous Django projects/deployments I would suggest to do the following:

  • Change directory structure to something more modular and structured
  • Lose all old south migrations and create inital ones for 1.8
  • Check all models for changes with 1.8, because there will be
  • Get a mysql slave up on my vps to test the new setup
  • Use nginx as reverse proxy for gunicorn and to serve static content (and node.js if it's used)
  • Use supervisord to keep an eye on processes (gunicorn, node.js, etc.)
  • Integrate existing config in a more generic way of handling configs (dev/staging/live)
  • Start rewriting views (from what I have seen, this should be quite doable with existing packages like django-class-based-auth-views and the work already done)
@rj76
rj76 / gist:cdb5163533b34cc4ff57d5a2ab1fde69
Created November 6, 2018 09:48
nouveau /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
#!/bin/bash
FILES_PATTERN='\.py$'
FORBIDDEN='import ipdb'
MSG="COMMIT REJECTED. Found \"${FORBIDDEN}\" references. Please remove them before commiting."
# check for debug stuff
git diff --name-only | \
grep -E $FILES_PATTERN | \
GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n "$FORBIDDEN" && echo $MSG && exit 1
@rj76
rj76 / locustfile.py
Created December 8, 2018 17:16
Use locust on all API views in project
import json
from io import StringIO
import os
import django
from django.conf import settings
from django.core import management
from locust import HttpLocust, TaskSet
### Keybase proof
I hereby claim:
* I am rj76 on github.
* I am oxyrichard (https://keybase.io/oxyrichard) on keybase.
* I have a public key ASAXOdPNXWahu0cory-Engtu0WZ3a48Dfwc1jLHciXa9vwo
To claim this, I am signing this object:
@rj76
rj76 / keybase.md
Last active March 31, 2019 10:18
keybase

Keybase proof

I hereby claim:

  • I am rj76 on github.
  • I am 0xrichard (https://keybase.io/0xrichard) on keybase.
  • I have a public key ASBa3RLwqZyJRBbPyDqlL0T1HAaGkAyM3vuKbSeHW_3bMwo

To claim this, I am signing this object:

@rj76
rj76 / gsuite-protonmail.md
Created April 3, 2019 14:57
GSuite -> Protonmail
  • install protonbridge
  • setup thunderbird for protonbridge
  • change MX records main domain to point to protonmail
  • setup MX records other domain to point to google
  • setup accounts on new domain in google
  • migrate mail from users old domain to users new domain
  • wait
  • setup accounts new domain in thunderbird
  • move mail from accounts new domain to protonmail account
  • let it sync