Skip to content

Instantly share code, notes, and snippets.

View yuyobit's full-sized avatar

m4r71n yuyobit

View GitHub Profile

PIL(Pillow) build on Windows (32bit)

If you want to build PIL on Windows, you need to prepare few external libraries. Although some libraries did not provide static library for windows 32/64 bits then you need to build these libraries by your hand too. Also, PIL will load by python at last then you are recommended to use same compiler with python to build libraries.

Target PIL and versions

PIL:1.1.7 for Python 2.4 (or Pillow-1.7.8)

PIL(Pillow) build on Windows (32bit & 64bit)

If you want to build PIL on Windows, you need to prepare few external libraries. Although some libraries did not provide static library for windows 32/64 bits then you need to build these libraries by your hand too. Also, PIL will load by python at last then you are recommended to use same compiler with python to build libraries.

Target PIL and versions

Pillow:1.7.8 for Python 2.7: src
@yuyobit
yuyobit / helloworld-win32-service.py
Last active September 4, 2015 18:42 — forked from drmalex07/helloworld-win32-service.py
An example Windows service implemented with pywin32 wrappers. #python #windows-service #pywin32
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
import time
import logging
logging.basicConfig(
filename = 'c:\\Temp\\hello-service.log',
@yuyobit
yuyobit / txt2nc.py
Created October 21, 2015 01:09 — forked from jdherman/txt2nc.py
Convert ASCII data to NetCDF (Python)
from __future__ import division
from netCDF4 import Dataset
import numpy as np
import os
PATH = '.'
LL = np.loadtxt('%s/global_soils_default.txt' % PATH);
LL = LL[:,2:4]
OBS = np.loadtxt('%s/VIC_GRDC_Monthly_Climatology.txt' % PATH, delimiter=',', skiprows=1)
@yuyobit
yuyobit / flask-uwsgi-nginx-primer.md
Created March 5, 2016 22:02 — forked from mplewis/flask-uwsgi-nginx-primer.md
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@yuyobit
yuyobit / index.html
Created December 27, 2016 19:11 — forked from aaizemberg/index.html
Radios censales del censo 2010, Argentina. (fuente: INDEC)
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<title>INDEC | Censo 2010 | Radios Censales por provincia</title>
</head>
<body>
<h1>por fín, era hora</h1>
@yuyobit
yuyobit / detect-swipe.js
Created April 4, 2017 11:00 — forked from isaacdontjelindell/detect-swipe.js
WinJS swipe detection
// item param is an HTML element.
_listenForSwipe: function (item) {
var context = new Object();
item.addEventListener("MSPointerDown", function (e) {
//if (e.pointerType == 2) {
if (e.pointerType == "touch") {
context._gestureInfos = new Object();
context._gestureInfos.started = true;
@yuyobit
yuyobit / IndexedDB101.js
Created April 12, 2017 18:04 — forked from JamesMessinger/IndexedDB101.js
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@yuyobit
yuyobit / __main__.py
Created June 4, 2017 11:31 — forked from drgarcia1986/__main__.py
Example of OAuth2 autentication server with Client Credentials grant (using python-oauth2 and tornado)
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Diego Garcia'
import tornado.web
import tornado.ioloop
import oauth2.tokengenerator
import oauth2.grant
import oauth2.store.redisdb
import oauth2.store.mongodb
@yuyobit
yuyobit / progress.py
Created August 14, 2017 14:01 — forked from vladignatyev/progress.py
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#