Skip to content

Instantly share code, notes, and snippets.

View cb109's full-sized avatar
💭
🍴 🐘

Christoph Bülter cb109

💭
🍴 🐘
View GitHub Profile
@cb109
cb109 / 1_CSS.css
Last active December 13, 2017 13:56
CSS vs Stylus
.desktop-mode.application {
margin: 0 auto;
max-width: 1280px;
}
.desktop-mode.shadow-box {
position: fixed;
height: 100%;
width: 100%;
z-index: -99;
max-width: 1280px;
@cb109
cb109 / user_sessions.py
Last active December 21, 2017 10:27
List all Django Sessions for a User
from django.contrib.sessions.models import Session
def yield_user_sessions(user):
"""Yield all Sessions associated with the user.
Note: This is extremely inefficient, since we have to deserialize
all existing Sessions. Consider this a debugging helper, not
a production tool. Should we need more frequent access to this
information, then adding a separate model to map users to
@cb109
cb109 / wow_chroma.py
Created January 21, 2018 15:18
Razer Chroma WoW Health and Mana
"""
Displays WoW health and mana status on a Razer Chroma keyboard.
Installation (Windows):
$ virtualenv venv
$ pip install requests
$ easy_install pillow
Usage:
- Run WoW client fullscreen on main monitor
@cb109
cb109 / scrape_world_cup_matches.py
Last active June 14, 2018 10:58
Scrape historical soccer world cup match results from the FIFA archive (https://codepen.io/cb109/pen/rKmbmL?editors=1010)
# -*- coding: utf-8 -*-
"""Scrape all historical soccer world cup match results into a JSON file."""
import json
import requests
from bs4 import BeautifulSoup
urls = [
@cb109
cb109 / ngrok_to_qr.sh
Last active July 10, 2018 08:30
Render ngrok URL as QR code in your terminal
#!/bin/bash
#
# Assuming you have a running ngrok session, this snippet fetches the
# https URL from ngrok's local API and renders it as a QR code in your
# terminal. You can then scan it with a mobile phone to quickly load
# that URL.
#
# Based on:
# https://github.com/stedolan/jq/issues/861
#
@cb109
cb109 / example_use.gif
Last active September 21, 2018 08:31
Format lists in Sublime exactly the way I like it.
example_use.gif
@cb109
cb109 / conftest.py
Last active October 10, 2018 08:03
Blinkstick as feedback device for pytest. Works great with one of these: https://www.blinkstick.com/products/blinkstick-square
"""
Dependencies:
$ pip install blinkstick
"""
from blinkstick import blinkstick
def pytest_runtestloop(session):
@cb109
cb109 / Default (Linux).sublime-mousemap
Last active October 15, 2018 06:45
Allow two word selection behaviours at the same time in Sublime.
[
{
"button": "button1",
"modifiers": ["alt"],
"command": "select_underscored_word",
},
]
@cb109
cb109 / UserInitials.vue
Last active October 15, 2020 09:19
Vuetify User Initials Avatar
<template>
<v-avatar v-if="user !== null"
:size="size"
:style="{'background-color': backgroundColor}">
<strong class="initials"
:style="{'color': fontColor,
'font-size': fontSize}">
{{ (user.first_name[0] + user.last_name[0]) || '?' }}
</strong>
@cb109
cb109 / Anaconda.sublime-settings
Last active November 20, 2018 14:01
Sublime Text 3 Settings Files
{
// Make sure to follow the README about 'Auto-complete for import
// behaves badly' to enable autocompletion for 3rd party packages.
// https://github.com/DamnWidget/anaconda#auto-complete-drop-down-shows-up-incorrectly
// For some stupid reason this is not taken correctly from what our
// project is using, so we duplicate it here. Otherwise validation
// of imports and unused symbols doesn't work.
"python_interpreter": "/home/<user>/.virtualenvs/<project>/bin/python",