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 json | |
from random import randint | |
from flask import Flask | |
from flask import request | |
from flask import make_response | |
app = Flask(__name__) |
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
# -*- coding: utf-8 -*- | |
""" | |
Usage: | |
python s3upload.py -b bucket -i image.jpg | |
python s3upload.py -b bucket -f images -i image.jpg | |
python s3upload.py -b bucket -f images -i image.jpg -t img.jpg | |
python s3upload.py -p tokyo -b bucket -i image.jpg | |
""" | |
from argparse import ArgumentParser |
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
#!/usr/bin/env python | |
""" | |
Usage: | |
python detectface.py -i image.jpg | |
""" | |
from argparse import ArgumentParser | |
import boto3 | |
from pprint import pprint |
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
# https://trac.ffmpeg.org/wiki/Encode/VP9 | |
# audio: libvorbis | |
# brew install ffmpeg --with-libvpx --with-libvorbis | |
# lossless and without audio | |
ffmpeg -i test.avi -lossless 1 -an output.webm | |
# Variable Bitrate: 1 MBit/s | |
ffmpeg -i test.avi -c:v libvpx-vp9 -b:v 1M -an output.webm |
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
# -*- coding: utf-8 -*- | |
# | |
# imagefont.py | |
# | |
from PIL import Image, ImageDraw, ImageFont | |
# image = Image.open('cats.png') | |
# width, height = image.size | |
image = Image.new("RGBA",(500,1000),(0,0,0,255)) | |
width, height = image.size |
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
# isobard.py | |
# read rfid -> pkill -> get user info -> exec face detecter | |
# | |
# connect to it with: | |
# echo -n "0001864282 edith"|nc -w 0 localhost 5555 | |
# | |
from socket import * | |
from time import sleep | |
import subprocess |
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
#!/usr/bin/env python | |
import cv2 | |
import gevent | |
import time | |
from ticket import ticket | |
from socket import * | |
from gevent import Greenlet | |
from gevent.threadpool import ThreadPool | |
from gevent.select import select as gselect |
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
# -*- coding: utf-8 -*- | |
import gevent | |
from gevent.queue import Queue | |
from urllib2 import urlopen | |
from gevent.threadpool import ThreadPool | |
def worker(n): | |
while not tasks.empty(): | |
task = tasks.get() | |
print('Worker %s got task %s' % (n, task)) |
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/bash | |
# tmux requires unrecognized OSC sequences to be wrapped with DCS tmux; | |
# <sequence> ST, and for all ESCs in <sequence> to be replaced with ESC ESC. It | |
# only accepts ESC backslash for ST. | |
function print_osc() { | |
if [[ $TERM == screen* ]] ; then | |
printf "\033Ptmux;\033\033]" | |
else | |
printf "\033]" |
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
# ScanCardReader.py | |
# -*- coding: utf-8 -*- | |
# scanning usb rfid card reader. | |
import evdev | |
from evdev import InputDevice, categorize, ecodes | |
from select import select | |
input = evdev.InputDevice('/dev/input/event0') |