Skip to content

Instantly share code, notes, and snippets.

@i5on9i
i5on9i / aes.py
Created February 11, 2018 09:57
ported aes.py to use python3
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
This is a port of Chris Veness' AES implementation: http://www.movable-type.co.uk/scripts/aes.html
Copyright ⓒ2005-2008 Chris Veness. Right of free use is granted for all
commercial or non-commercial use. No warranty of any form is offered.
Ported in 2009 by Markus Birth <markus@birth-online.de>
2018-02 by namh
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
init-hook='import sys; sys.path.append("c:/a/programming/python/spider_blogupdater/src");
sys.path.append("c:/a/envs/spider3/Lib/site-packages");
sys.path.append("c:/a/envs/spider3/Lib")'
# coding=utf-8
from rest_framework import exceptions
from rest_framework.authentication import BaseAuthentication, CSRFCheck
__author__ = 'namh'
class CsrfAuthentication(BaseAuthentication):
"""
"""Production settings and globals."""
from __future__ import absolute_import
from os import environ
from .base import *
# Normally you should not import ANYTHING from Django directly
@i5on9i
i5on9i / base.py
Last active April 14, 2017 13:03
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
@i5on9i
i5on9i / vscode.tmTheme
Created June 29, 2016 03:11
sublimetext color theme : this is vscode-like color theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
vscode like theme by namh
-->
<plist version="1.0">
<dict>
<key>name</key>
<string>vscode</string>
<key>settings</key>
/**
Pure javascript instead of jQuery
code is from http://youmightnotneedjquery.com/
*/
/**
* to serialize the inputs' data of the {@param form}
*/
const serialize = (fromEl)=>{
@i5on9i
i5on9i / zipfile_usage.py
Last active July 20, 2016 04:47
how to use zipfile of python / how to zip folder
import zipfile
import os, os.path
def unzip(filename, dest):
with zipfile.ZipFile(filename) as zf:
zf.extractall(dest)
def zipdir(newFilename, targetPath):
+-----------+ +-----------+
| | | |
| client | | server |
+-----------+ +-----------+ +-------------------------+
+ + | global_message_buffer |
| |+----------------------------->| |
| POST button is clicked | +-----------+-------------+
| uri: a/message/new | +
/**
You could use this source for babel-react / babel-ecma6
*/
//--------------------------------
//
// main.js
//
//--------------------------------