Skip to content

Instantly share code, notes, and snippets.

View limkokhole's full-sized avatar
🌴
On vacation

林果皞 limkokhole

🌴
On vacation
View GitHub Profile
@limkokhole
limkokhole / README.md
Created February 12, 2020 20:48 — forked from livibetter/README.md
Tkinter (Tk/Ttk) Progressbar widget example
#!/usr/bin/env python
# Tkinter (Tk/Ttk) Progressbar widget example
#
# Written by Yu-Jie Lin
# This code is placed in Public Domain
#
# Gist: https://gist.github.com/livibetter/6850443
# Clip: https://www.youtube.com/watch?v=rKr8wjKuhBY
#
# References:
@limkokhole
limkokhole / aes.py
Created January 23, 2020 12:12 — forked from gsakkis/aes.py
Porting AES from M2Crypto to Crypto
from binascii import hexlify, unhexlify
from hashlib import md5
from Crypto.Cipher import AES
try:
from M2Crypto import EVP
except ImportError:
EVP = None
def m2_encrypt(plaintext, key, iv, key_as_bytes=False, padding=True):
@limkokhole
limkokhole / adjust_video_speed.md
Created January 18, 2020 01:44 — forked from hermanschaaf/adjust_video_speed.md
Adjust Speed of a Video with ffmpeg

To increase speed of a video by a factor of 1.5x:

ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=PTS/1.5[v];[0:a]atempo=1.5[a]" -map "[v]" -map "[a]" output.mp4

We can use this to adjust the speed of all the videos in a directory (Linux and macOS only):

mkdir -p output
@limkokhole
limkokhole / webserver.py
Created January 14, 2020 12:29 — forked from patmandenver/webserver.py
Python SimpleHTTPServer with header outputs
#!/usr/bin/python
#
# Author: Patrick Bailey
# Twitter: @whiteboardoder
#
#The MIT License (MIT)
#
#Copyright (c) 2016 "whiteboardcoder" Patrick Bailey
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
@limkokhole
limkokhole / post-server.py
Created January 14, 2020 12:29 — forked from kylemcdonald/post-server.py
Python POST simple server
import SimpleHTTPServer
import SocketServer
PORT = 8000
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
content_len = int(self.headers.getheader('content-length', 0))
post_body = self.rfile.read(content_len)
@limkokhole
limkokhole / m3u8_decryptor.py
Created January 5, 2020 20:44 — forked from delimitry/m3u8_decryptor.py
Python script for download and decrypt TS chunks from m3u8 file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import requests
import sys
from Crypto.Cipher import AES
@limkokhole
limkokhole / app.py
Last active December 9, 2019 05:24 — forked from carlos-jenkins/app.py
Example to set to a Gtk application a custom theme.
# -*- coding:utf-8 -*-
#
# Copyright (C) 2013 Carlos Jenkins <carlos@jenkins.co.cr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
#!/usr/bin/perl -w
use strict;
use IO::Socket::INET;
use IO::Socket::SSL;
use Getopt::Long;
use Config;
$SIG{'PIPE'} = 'IGNORE'; #Ignore broken pipe errors
print <<EOTEXT;
@limkokhole
limkokhole / query-parser.rb
Created October 1, 2019 11:52 — forked from jamis/query-parser.rb
A simple example of a BNF-based, recursive-descent parser for reading a field-based query string
require 'strscan'
# expr := term
# | term AND expr
# | term OR expr
# term := value
# | atom ':' value
# atom := word+
# | quoted_string
# value := atom