View gist:19e2132d62e09cedb5321bb159cb4c18
syntax on
set number
set relativenumber
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
View views.py
class FilterCurrentUserMixin(object):
def get_queryset(self):
queryset = super(FilterCurrentUserMixin, self).get_queryset()
queryset = queryset.filter(user=self.request.user)
return queryset
View timelapse.py
import datetime
import io
import time
import picamera
from PIL import Image, ImageStat, ImageFont, ImageDraw
with picamera.PiCamera() as camera:
View de-fuck-mysql.sh
#!/bin/bash
# de-fuck mysql 5.7
# This script allow you to log on MySQL as root user without use sudo
# sudo apt install postgresql
# sudo apt purge "mysql-*"
# you know, would be better...
sudo mysql -u root -e "CREATE USER 'root2'@'localhost';"
View cloudflare.sh
#!/bin/bash
set -x
EMAIL=''
API_KEY=''
ZONE_ID=''
RECORD_ID=''
View test_request_mock.py
# -*- coding: utf-8 -*-
import mock
import requests
def make_request():
try:
return requests.get('http://httpbin.org/ip').json()['origin']
View stargazers.py
# -*- coding: utf-8 -*-
import requests
API_URL = 'https://api.github.com/repos/{owner}/{repo}'
client = requests.Session()
client.auth = ('dvl', 'xx')
client.headers.update({
'Accept': 'application/vnd.github.v3+json',
View bobp-python.md

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
View README.md
View pure.zsh
# Pure
# by Sindre Sorhus
# https://github.com/sindresorhus/pure
# MIT License
# For my own and others sanity
# git:
# %b => current branch
# %a => current action (rebase/merge)
# prompt: