Skip to content

Instantly share code, notes, and snippets.

View xlyk's full-sized avatar
🏠
Working from home

Kyle Hanks xlyk

🏠
Working from home
  • Los Angeles, CA
View GitHub Profile
@EdwardPrentice
EdwardPrentice / install_docker.sh
Created April 23, 2018 18:38
Install Docker on Ubuntu
#!/bin/bash -eu
sudo apt-get update
echo "Installing docker"
sudo apt-get -y install apt-transport-https
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
@keepitsimple
keepitsimple / gist:a0aa7a2e10ab930d741d
Last active April 10, 2019 13:41
Ubuntu 14.04 install Xvfb
# Dependencies to make "headless" chrome/selenium work:
sudo apt-get -y install xvfb gtk2-engines-pixbuf
sudo apt-get -y install xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable
echo "Starting X virtual framebuffer (Xvfb) in background..."
Xvfb -ac :99 -screen 0 1280x1024x16 &
export DISPLAY=:99
@drmalex07
drmalex07 / test-datetime-json-dumps.py
Created May 15, 2014 12:57
Create JSON dumps aware of datetime.datetime objects, in Python. #json #python #dumps #datetime
import json
import datetime
'''Create an encoder subclassing JSON.encoder.
Make this encoder aware of our classes (e.g. datetime.datetime objects)
'''
class Encoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime):
return obj.isoformat()
@defrex
defrex / pretty_request.py
Last active September 8, 2023 14:33
A simple function to print a Django request the way requests are meant to be printed.
def pretty_request(request):
headers = ''
for header, value in request.META.items():
if not header.startswith('HTTP'):
continue
header = '-'.join([h.capitalize() for h in header[5:].lower().split('_')])
headers += '{}: {}\n'.format(header, value)
return (