Skip to content

Instantly share code, notes, and snippets.

@selahssea-zz
selahssea-zz / open-chrome.sh
Last active November 20, 2018 13:17
Google Chrome disable web security (CORS) on Mac OS X
#!/bin/bash
open /Applications/Google\ Chrome\ Canary.app/ --args --disable-web-security
@pythoninthegrass
pythoninthegrass / install_mosh_centos7.sh
Created May 25, 2018 23:10
Install mosh on CentOS 7
#!/usr/bin/env bash
# SOURCE: https://eligiblestore.com/blog/2017/05/02/how-to-install-mosh-on-centos/
# ensure running as root
if [[ "$(id -u)" != "0" ]]; then
exec sudo "$0" "$@"
fi
# install mosh
yum install -y epel-release
@reinefjord
reinefjord / history-and-back.flask.py
Created May 19, 2019 10:01
Functions for saving user browsing history and getting a url for the previous page visited in flask. Lots of edge cases left.
@app.after_request
def save_response(r):
if flask.request.method == 'POST':
return r
if flask.request.endpoint == 'static':
return r
history = flask.session.get('history', [])
@rms1000watt
rms1000watt / jinja2-omit-comma-from-item.txt.j2
Created October 18, 2019 21:10
Jinja2 omit comma from last item in list
# Courtesy of: https://stackoverflow.com/a/11974399
{%- for item in items %}
[
"{{item}}"{{ "," if not loop.last }}
]
{%- endfor %}
/* Basic specificity cheatsheet */
h1 {
/* Native elements have a weight of 0001. */
}
::after {
/* Pseudo-elements have a weight of 0001. */
}
# Format Specification Mini-Language (Quick Reference)
import datetime
integer = 5
negative_integer = -5
decimal = 6.9
negative_decimal = -6.9
string = 'hi'
cost_float = 1299.99
cost_integer = 150000