Skip to content

Instantly share code, notes, and snippets.

View infantiablue's full-sized avatar
🎯
Focusing

Truong Phan infantiablue

🎯
Focusing
View GitHub Profile
@justinmklam
justinmklam / flask-port80-without-sudo.md
Last active June 21, 2024 19:59
Run a flask app on port 80 without sudo.

Flask apps are bound to port 5000 by default. To bind it to port 80, you would need to change the port as follows:

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80, debug=True)

And to run it:

@480
480 / gist:3b41f449686a089f34edb45d00672f28
Last active July 3, 2024 03:59
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings

MacOS X + oh my zsh + powerline fonts + visual studio code (vscode) terminal settings

Thank you everybody, Your comments makes it better

Install oh my zsh

http://ohmyz.sh/

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
@wushaobo
wushaobo / .block
Last active October 16, 2023 08:25
Flask server-side session with redis
license: gpl-3.0
border: no
@nickoala
nickoala / 0_python_email.md
Last active June 16, 2024 12:58
Use Python to send and receive emails

Use Python to:

  • send a plain text email
  • send an email with attachment
  • receive and filter emails according to some criteria
@tomysmile
tomysmile / mac-setup-redis.md
Last active July 16, 2024 04:45
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active July 3, 2024 02:22
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@jankuo
jankuo / app.py
Last active October 10, 2015 02:07 — forked from wynemo/nginx.conf
tornado supervisor ubuntu12.04
# -*- coding:utf-8 -*-
import sys, os
import logging
import logging.config
import tornado
import tornado.wsgi
import tornado.httpserver
import tornado.ioloop
from tornado.options import define, options, parse_command_line
@misaelnieto
misaelnieto / live-mjpeg-stream.py
Last active June 26, 2024 10:08
Streaming MJPEG over HTTP with gstreamr and python - WSGI version
#!/usr/bin/python
#based on the ideas from http://synack.me/blog/implementing-http-live-streaming
# Updates:
# - 2024-04-24: Apply suggestions from @Pin80
# Run this script and then launch the following pipeline:
# gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999
#updated command line
#gst-launch-1.0 videotestsrc pattern=ball ! videoconvert ! video/x-raw, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! #tcpclientsink port=9999
from multiprocessing import Queue
@hoatle
hoatle / Controller.js
Created April 10, 2012 10:44
JavaScript Router using underscore, requirejs
/**
* The routing controller object.
*
* Usage:
* + Define the routing table by controller.map(valueRegex, callback);
* the callback will be called and passed the value as the first argument.
* + Routing action by: controller.route(definedValue). If no definedValue matches, do nothing.
*/
define(
try:
# for Python 2.x
from Queue import Queue
except ImportError:
# for Python 3.x
from queue import Queue
from threading import Thread, Event
import random
import sys