Skip to content

Instantly share code, notes, and snippets.

Avatar

Derek Kwok derekkwok

View GitHub Profile
@derekkwok
derekkwok / async-server.py
Created Feb 2, 2016
Python 3.5 async "Hello World" server
View async-server.py
import asyncio
import socket
SERVER_ADDRESS = (HOST, PORT) = '', 8888
REQUEST_QUEUE_SIZE = 5
http_response = b"""\
HTTP/1.1 200 OK
Hello, World!
"""
@derekkwok
derekkwok / encode.go
Last active Dec 17, 2015
This is the Go version of encode.py written for Windows 7
View encode.go
// This is a go script that encodes all files with mkv extension in the current
// working directory.
//
// NOTE: To use this script on Windows, you must download the fontconfig file
// which can be found at:
// http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=10&t=318&start=10
//
//
// Sources:
// http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
@derekkwok
derekkwok / storage.py
Created Nov 29, 2012
A subclass of FileSystemStorage that checks if content.file has attribute 'temporary_file_path'
View storage.py
import errno, os
from django.conf import settings
from django.core.files import locks
from django.core.files.move import file_move_safe
from django.core.files.storage import FileSystemStorage
class CustomStorage(FileSystemStorage):
"""
This storage class tries to move files instead of copy when saving via
@derekkwok
derekkwok / encode.py
Last active Nov 23, 2020
Simple python script to encode videos using ffmpeg
View encode.py
"""
This python script encodes all files that have the extension mkv in the current
working directory.
Sources:
http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
"""
import subprocess, os
#-------------------------------------------------------------------------------
You can’t perform that action at this time.