Skip to content

Instantly share code, notes, and snippets.

Michael Le mike1e

View GitHub Profile
mike1e / hosts
Created Oct 30, 2017
Dan Pollock hosts file
View hosts
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
## localhost localhost.localdomain local broadcasthost
::1 localhost
mike1e / index.html
Created Jan 26, 2016 | Static site generator tutorial
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
mike1e / gulpfile.js
Created Jan 26, 2016 | Static site generator tutorial
View gulpfile.js
var gulp = require('gulp');
var browserSync = require('browser-sync');
gulp.task('serve', function() {
server: {
baseDir: 'app' // Change this to your web root dir
View gist:f407230551a4ba8cd0bf
tell application "Google Chrome"
set pageUrl to get URL of active tab of first window
end tell
tell application "Safari" to add reading list item pageUrl
View gist:9a60204cadc5afd1b21a
scalesvg ()
svgwidthxheight=$(identify "$svgfile" | cut -d ' ' -f 3)
mike1e /
Last active Jan 3, 2016
Flask authorization
def login_required(role="ANY"):
def wrapper(fn):
def decorated_view(*args, **kwargs):
if not current_user.is_authenticated():
return current_app.login_manager.unauthorized()
urole = current_user.get_role()
if ( (urole != role) and (role != "ANY")):
mike1e / venv_folder
Last active Dec 29, 2015
switch folders with virtualenv
View venv_folder
# In the postmkvirtualenv script I have the following to create a directory based on the project name,
# add that directory to the python path and then cd into it:
proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}')
mkdir $HOME/projects/$proj_name
add2virtualenv $HOME/projects/$proj_name
cd $HOME/projects/$proj_name
# In the postactivate script I have it set to automatically change to the project
# directory when I use the workon command:
mike1e / gist:7610855
Created Nov 23, 2013
Jinja2 / Bootstrap Navigation Active Page highlighting
View gist:7610855
<ul class="nav nav-pills pull-right">
{%- for endpoint, caption in [
('index', 'Index'),
('add_user', 'Add User')
] %}
<li{% if endpoint == request.endpoint %} class="active"{% endif %}>
<a href={{ url_for(endpoint) }}>{{ caption }}</a>
{%- endfor %}
mike1e / secret_key
Created Nov 22, 2013
create secret key
View secret_key
python -c "import os; print repr(os.urandom(24))"
View .vimrc
" => General
" Set to auto read when file is changed from outside
set autoread
" Sets how many lines of history VIM has to remember
set history=700
" Enable filetype plugins
You can’t perform that action at this time.