git
discard all local changes/commits and pull from upstream
git reset --hard origin/master
git pull origin master
development: | |
adapter: mysql2 | |
encoding: utf8 | |
database: my_database | |
username: root | |
password: | |
apt: | |
- somepackage | |
- anotherpackage |
font-family: -apple-system, BlinkMacSystemFont, “Roboto”, “Droid Sans”, “Helvetica Neue”, Helvetica, Arial, sans-serif; |
tell i term application "System Events" to keystroke "D" using command down | |
tell i term application "System Events" to keystroke "d" using command down |
#! /bin/sh | |
# @author: Claus Witt | |
# http://clauswitt.com/319.html | |
# Adding or Removing Items to hosts file | |
# Use -h flag for help | |
DEFAULT_IP=127.0.0.1 | |
IP=${3:-$DEFAULT_IP} |
# Use this with a git alias like `cl = "!sh ~/clone_helper.sh"` | |
# A bash function to replace `git clone` could also be done | |
# like in https://stackoverflow.com/a/39357426/999505 | |
set -e | |
if [ $# = 0 ]; then # forgot to pass anything, d'oh | |
echo ERROR Must pass repo path to clone | |
exit 1 | |
fi |
git
discard all local changes/commits and pull from upstream
git reset --hard origin/master
git pull origin master
// This is a typical throttle implementation with the difference that it doesn't discard | |
// the final invocation - instead it runs it at the next valid timeslice. | |
throttleBoss: function(callback, delay) { | |
var ready = true, | |
args = null; | |
return function throttled() { | |
var context = this; |
class MyEventEmitter { | |
constructor() { | |
this._events = {}; | |
} | |
on(name, listener) { | |
if (!this._events[name]) { | |
this._events[name] = []; | |
} |
""" | |
Simple demonstration of how to implement Server-sent events (SSE) in Python | |
using Bottle micro web-framework. | |
SSE require asynchronous request handling, but it's tricky with WSGI. One way | |
to achieve that is to use gevent library as shown here. | |
Usage: just start the script and open http://localhost:8080/ in your browser. | |
Based on: |
const http2 = require('http2'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const zlib = require('zlib'); | |
const brotli = require('brotli'); // npm package | |
const PORT = 3032; | |
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares | |
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/'); | |
const cache = {}; |