Skip to content

Instantly share code, notes, and snippets.

View pingf's full-sized avatar
💭
waiting for delivery!

Makefile君 pingf

💭
waiting for delivery!
View GitHub Profile
@pingf
pingf / dash_button.py
Created July 6, 2017 15:28
dash_2button_switch
# -*- coding: utf-8 -*-
from time import sleep
import dash
from dash_core_components import Graph
from dash_html_components import H1, Div, Button
from comp import Button
from dash.dependencies import Input, Output, Event, State
app = dash.Dash()
@pingf
pingf / stream_to_youtube.sh
Created March 17, 2017 07:15 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@pingf
pingf / btree.py
Created November 24, 2016 03:26 — forked from teepark/btree.py
a pure-python B tree and B+ tree implementation
import bisect
import itertools
import operator
class _BNode(object):
__slots__ = ["tree", "contents", "children"]
def __init__(self, tree, contents=None, children=None):
self.tree = tree
@pingf
pingf / gist:59b46ae40a8ee743ff54ffadeb608310
Created November 1, 2016 08:15 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@pingf
pingf / gist:dbd16cdbeed84a007def
Created March 1, 2016 03:10 — forked from hest/gist:8798884
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@pingf
pingf / login-example
Created February 23, 2016 08:48 — forked from bkdinoop/login-example
Flask-Login : login.py created by https://github.com/maxcountryman : Matthew Frazier
# -*- coding: utf-8 -*-
"""
Flask-Login example
===================
This is a small application that provides a trivial demonstration of
Flask-Login, including remember me functionality.
:copyright: (C) 2011 by Matthew Frazier.
:license: MIT/X11, see LICENSE for more details.
"""
@pingf
pingf / gist:aeb6d3a1068f6f8c1c0c
Last active August 29, 2015 14:07
interactive menu
#coding=utf-8
from blessings import Terminal
import readchar
from readchar import key
import os
terminal = Terminal()
current = 0
choices = ['a','b','c']
#os.system('clear')