This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import struct | |
def parse_mri_data_to_webp_buffer(data): | |
size_list = [0] * 4 | |
size = len(data) | |
header_size = size + 7 | |
# little endian byte representation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local moses = require("moses") | |
local function parse_mri_data_to_webp_buffer (mri_data) | |
local size = #mri_data | |
local webp_size = size + 7 | |
local webp_size_as_byte = string.pack("<I", webp_size) | |
local webp_buffer = { | |
82, -- R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local moses = require("moses") | |
local function parse_mri_to_webp(mri_path) | |
local name = string.match(mri_path, "(%w+)%.") | |
local fsi = io.open(mri_path, "rb") | |
local idata = fsi:read("*all") | |
fsi:close() | |
local size = #idata | |
local n = size + 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "watching moon files under $(pwd)"; | |
inotifywait -m -r -q -e create -e close_write -e moved_from -e moved_to $(pwd) | | |
while read path action file; do | |
name="$path$file"; | |
# ignore everything that is not a moonfile | |
if echo "$file" | grep -q ".moon$" ; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
inotifywait -m -r -q --exclude "" -e create -e close_write -e move $(pwd) | | |
while read path action file; do | |
if [[ $path == \.moon$ ]]; then | |
if [ $action = 'MOVED_FROM' ] || [ $action = 'DELETE' ]; then | |
rm "${path/\.moon$/.lua}"; # clean up lua file | |
else | |
moonc $path; | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, Blueprint | |
from flask.ext.admin import Admin | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext.admin.contrib.sqla import ModelView | |
app = Flask(__name__) | |
app.debug = True | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db' | |
db = SQLAlchemy(app) |