This file contains hidden or 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
def function_time(func, arg=()): | |
''' | |
The simple code that can estimate the computing time of the function and | |
return the same output of original one | |
:param func: The reference of the function you may want to estimate time | |
:param arg: The arguments of function, the default is () | |
:return: Return original output of the function | |
''' | |
t1 = timeit.default_timer() |
This file contains hidden or 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
''' | |
by Adrian Statescu <[email protected]> | |
Twitter: @thinkphp | |
G+ : http://gplus.to/thinkphp | |
MIT Style License | |
''' | |
''' | |
Binary Search Tree | |
------------------ |
This file contains hidden or 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 | |
''' | |
Python rpi monitor program | |
Call vcgencmd in shell and get the temp info and cpu clock info | |
20180314 | |
''' | |
import subprocess as sub | |
import time |
This file contains hidden or 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
{ | |
"protocol": "sftp", | |
"host": "ip_address", | |
"port": 22, | |
"username": "cftang", | |
"remotePath": "remote_path", | |
"privateKeyPath": "/Users/cftang/.ssh/id_rsa", | |
"passphrase": "/Users/cftang/.ssh/id_rsa.pub", | |
"uploadOnSave": true, | |
"ignore": [ |
This file contains hidden or 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
ffmpeg -i /dev/video0 -c:v libx264 -b:v 1M -preset ultrafast -s 1280x720 -r 30 test.mp4 |
This file contains hidden or 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
<html> | |
<head> | |
<script> | |
function show_image() { | |
document.getElementById("show").setAttribute("src", "data:image/jpeg;base64," + document.getElementById('base64_img').value); | |
} | |
</script> | |
</head> | |
<h1> Base64 encoding</h1> |
This file contains hidden or 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 time | |
import threading | |
class p: | |
def __init__(self): | |
self.flag = True | |
self.thread = threading.Thread(target=self.show) | |
self.thread.start() | |
def show(self): |
This file contains hidden or 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
" Don't try to be vi compatible | |
set nocompatible | |
" Helps force plugins to load correctly when it is turned back on below | |
filetype off | |
" TODO: Load plugins here (pathogen or vundle) | |
" Turn on syntax highlighting | |
syntax on |
This file contains hidden or 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
ffmpeg -f avfoundation -framerate 30 -s 1280x720 -i "1" -b:v 1M -preset ultrafast -s 1280x720 -r 30 test.mp4 |
This file contains hidden or 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
[Unit] | |
Description=pppoe | |
[Service] | |
Type=simple | |
WorkingDirectory=/usr/bin/ | |
ExecStart=/usr/bin/pon dsl-provider | |
Restart=always | |
[Install] |
OlderNewer