Skip to content

Instantly share code, notes, and snippets.

View phoikoi's full-sized avatar

Peter Hull phoikoi

View GitHub Profile
@phoikoi
phoikoi / django-dev-dockerfile
Last active October 19, 2018 01:51 — forked from spool/Dockerfile
Dockerfile for Django core development in progress from DjangoCon US 2018
# Apparently a very small example
# https://blog.realkinetic.com/building-minimal-docker-containers-for-python-applications-37d0272c52f3
FROM python:3
# Get current version of django
RUN git clone http://github.com/django/django
WORKDIR django
RUN apt-get update && apt-get install -y \
build-essential \
@phoikoi
phoikoi / datetime_range.py
Last active August 2, 2018 18:35 — forked from obeattie/datetime_range.py
A datetime range class for Python, for (obviously) dealing with ranges of datetimes.
"""Provides a `DateTimeRange` class, which is used for managing ranges of datetimes.
Forked from https://gist.github.com/obeattie/213328.
"""
import datetime
class DateTimeRange(object):
"""Represents a range of datetimes, with a start and (optionally) an end.
Basically implements most of the methods on a standard sequence data type to provide
some lovely syntactic sugar. Specifically, you can iterate on this, index it, slice it,
@phoikoi
phoikoi / imagewiththumbnails_updateable.py
Created June 21, 2018 05:21 — forked from valberg/imagewiththumbnails_updateable.py
Django create thumbnail form ImageField and save in a different ImageField - now with updating!
# Extension of http://www.yilmazhuseyin.com/blog/dev/create-thumbnails-imagefield-django/
# Note: image_folder and thumbnail_folder are both a callable (ie. a lambda that does a '/'.join())
class Image(Media):
image = models.ImageField(
upload_to=image_folder
)
thumbnail = models.ImageField(
@phoikoi
phoikoi / redux_setup.md
Last active February 22, 2018 23:39 — forked from kiok46/redux_setup.md
Redux, store, actions and reducers setup along with explanation.

Redux Setup

Implementation of redux inside any react.js or react-native application,

  • we will create an instance of the redux store.
  • We are going to create a provider tag from react redux library
  • Then render that provider tag passing in the store as a prop, then any child component to this provider tag will have access to this store through the context system inside of react.
  • import { Provider } from ‘react-redux’; // In main.js
  • to create a store create one in a separate folder.
@phoikoi
phoikoi / make_passbook.py
Created March 17, 2017 12:46 — forked from dschuetz/make_passbook.py
Simple hack to create Passbook .pkpass file
import sys, os.path, hashlib, re
import zipfile
import subprocess
from StringIO import StringIO
from io import BytesIO
#
# Passbook Hack
# David Schuetz
# 30 May 2014
@phoikoi
phoikoi / README.md
Last active August 29, 2015 14:01 — forked from vanto/README.md

FlickrImg Liquid Tag for Jekyll

This is a single-purpose fork of vanto's simple liquid tag that helps to easily embed images, videos or slides from OEmbed enabled providers, which in turn uses Magnus Holm's great oembed gem which connects to the OEmbed endpoint of the link's provider and retrieves the HTML code to embed the content properly (i.e. an Image tag for Flickr) This fork allows only Flickr embeds, from one particular album (since that's the way I work my blog) but allows a much simpler tag, not requiring you to type out the whole URL every time.

How to install

  1. Make sure you have the ruby-oembed gem (Rubygems, Github) installed.
  2. Copy flickrimg.rb to <your-jekyll-project>/_plugins
  3. Add a "flickrimg" config entry to your _config.yml, with an 'album' subentry which contains the bit of the flickr URL that identifies your album. In other words, if you have a Flickr URL such as `
#!/bin/sh
# on ubuntu: need some utils & dev libs
sudo apt-get install apache2-utils openssl libssl-dev libpcre3-dev
# compile nginx
cd /tmp
curl http://nginx.org/download/nginx-0.7.64.tar.gz | tar xz
cd nginx*
./configure --with-http_ssl_module --with-http_dav_module \

Server Install

Ubuntu

sudo apt-get update
sudo apt-get install -y xfce-session tightvncserver

Client Install

Mac (Comes with OS X)