Skip to content

Instantly share code, notes, and snippets.

View stefanfoulis's full-sized avatar

Stefan Foulis stefanfoulis

View GitHub Profile
@stefanfoulis
stefanfoulis / findauthors.sh
Created April 8, 2011 12:37
How to sync svn to git
#!/usr/bin/env bash
# Run this script inside a SVN checkout of the project
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
@stefanfoulis
stefanfoulis / docker_for_mac_disk_default_size.md
Last active June 29, 2023 12:02
How to resize Docker for Mac Disk image and set the default size for new images

Set the default size for new Docker for Mac disk images

UPDATE: The instructions here are no longer necessary! Resizing the disk image is now possible right from the UI since Docker for Mac Version 17.12.0-ce-mac49 (21995).

If you are getting the error: No space left on device

Configuring the qcow2 size cap is possible in the current versions:

# my disk is currently 64GiB
@stefanfoulis
stefanfoulis / auth_views.py
Created August 11, 2011 16:44
django: class based authentication view (login)
#-*- coding: utf-8 -*-
import urlparse
from django.contrib.auth import REDIRECT_FIELD_NAME, login
from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.generic.edit import FormView
from django.conf import settings
@stefanfoulis
stefanfoulis / delete_docker_logs.sh
Created September 16, 2014 09:05
delete docker logs
find /var/lib/docker/containers/ -type f -name "*.log" -delete
@stefanfoulis
stefanfoulis / gist:5352655
Created April 10, 2013 07:51
google places autocomplete widget limited to cities
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("maps", "3.x", {callback: initialize, other_params:'sensor=false&libraries=places'});
function initialize() {
var input = document.getElementById('id_location');
var autocomplete = new google.maps.places.Autocomplete(input, { types: ['(cities)'], region:'EU' });
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
if (!place.geometry) {
@stefanfoulis
stefanfoulis / gist:715194
Created November 25, 2010 10:39
django-filer: creating Folders and Files programmatically, If-Modified-Since aware download (quick and dirty)
def download_cover(url, name=None):
#print "========================== START"
#print "==== COVER URL: %s" % (url,)
purl = urlparse(url)
path = purl.path
if path.startswith('/'):
path = path[1:]
abspath = os.path.join(settings.MEDIA_ROOT,settings.RADIOPLAYLIST_COVERS_PREFIX,path)
relpath = os.path.join(settings.RADIOPLAYLIST_COVERS_PREFIX,path)
if not os.path.exists(os.path.dirname(abspath)):
@stefanfoulis
stefanfoulis / README.md
Last active June 10, 2021 03:18
raspberry pi setup

my raspberry pi setup

  • basic setup
  • auto-login on startup
  • chromium
  • shared user with google sync for bookmarks in chromium
  • auto-start chromium with shared bookmark in fullscreen mode (
  • setup synergy
  • setup ssh tunnel for synergy (with restricted rights) (client: ssh -f -N -L 24800:server-hostname:24800 server-hostname)
  • share ssh with zeroconf
@stefanfoulis
stefanfoulis / osx_developer_installation.rst
Last active December 23, 2019 02:32
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Brew User

@stefanfoulis
stefanfoulis / jwt_tests.py
Last active May 9, 2019 19:36
Create RS256 / RS512 Tokens and private/public keypairs for testing
import datetime
from typing import Iterable
import os
import uuid
import jwt
import pytz
import time
import calendar
@stefanfoulis
stefanfoulis / gist:030d7fa0d6d488c0c31f16652e20dbf4
Created October 26, 2018 19:04
Upgrade Poetry to version from git
RUN pipsi install --python=python3 poetry
# It is kind of hard to install from a .tar.gz of the repo if there is no
# setup.py in there.
RUN mkdir -p /tmp/poetry-master && cd /tmp/poetry-master && wget https://github.com/sdispater/poetry/archive/bdd7909ce7cb729975f31bfdbb4c756a1dd914dd.tar.gz && tar -xzvf bdd7909ce7cb729975f31bfdbb4c756a1dd914dd.tar.gz && cd poetry-bdd7909ce7cb729975f31bfdbb4c756a1dd914dd && poetry build && /root/.pipsi/venvs/poetry/bin/pip3 install --upgrade dist/poetry-0.12.4-py2.py3-none-any.whl