Skip to content

Instantly share code, notes, and snippets.

self.name = os.path.split(self.remote_path)[1]
download_temp = files.temp.NamedTemporaryFile(delete=True)
download_temp.write(urllib2.urlopen(self.remote_path).read())
download_temp.flush()
self.image_original.save(self.name, files.File(download_temp))
im=Image.open(self.image_original.path)
im.thumbnail((settings.POSTER_THUMBSIZE['x'], settings.POSTER_THUMBSIZE['y']), Image.ANTIALIAS)
img_temp = files.temp.NamedTemporaryFile(delete=True)
im.save(img_temp,'jpeg')
img_temp.flush()
@frog32
frog32 / pre-commit
Created November 25, 2011 11:11 — forked from spulec/pre-commit
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@frog32
frog32 / .gitignore
Created July 12, 2012 18:55
gitignore file for Latex projects
*.acn
*.acr
*.alg
*.aux
*.bbl
*.blg
*.dvi
*.glg
*.glo
*.gls

Serving Django and Twisted using HAproxy

Why?

Because we wanted to achive the following while developing a webapp using websockets:

Static serving (nginx), Django application (gunicorn) and Websockets service (twisted)

  • on the same IP
@frog32
frog32 / django.md
Last active August 29, 2015 13:56 — forked from sspross/django.md

Django

Entwicklungsumgebung einrichten

Brew installieren

  1. Existierende package manager löschen (fink, darwinports):

    sudo rm -r /sw /opt
    

sudo rm -r /usr/local/include/* /usr/local/lib/*

@frog32
frog32 / coffee_machine.yaml
Last active November 17, 2019 10:22
hass snippets
switch:
- platform: dlink
name: coffee
host: x.x.x.x
username: admin
password: !secret dlink_password
sensor:
- platform: template
sensors:
@frog32
frog32 / config.yaml
Created August 17, 2018 20:21
Smart Coffee Machine
esphomeyaml:
name: coffee_machine
platform: ESP8266
board: esp12e
wifi:
ssid: 'ssid'
password: '123456'
domain: .lan
@frog32
frog32 / loop.yaml
Created January 25, 2020 13:16
ESPhome configuration for the prober loop https://frog32.ch/blackbox-probing-home-assistant.html
esphome:
name: loop
platform: ESP8266
board: d1_mini
wifi:
ssid: 'WLAN SSID'
password: 'wlan password'
domain: .lan