This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import pathlib | |
import sys | |
import threading | |
import re | |
import subprocess | |
from pathlib import Path | |
from zipfile import ZipFile, ZIP_DEFLATED | |
from bottle import request, route, run, static_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# just copy this function into your google colab notebook, then use it | |
# a working example can be seen in this demo notebook: | |
# https://colab.research.google.com/drive/19Ni0EfOExQmTcrFZh3Z6DxsOM25KULqN?usp=sharing | |
import matplotlib.pyplot as plt | |
from matplotlib import animation, rc | |
def make_animate_train(train_step_fn, animate_setup_fn): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Colors reference | |
// You can use the following as so: | |
// console.log(colorCode, data); | |
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`); | |
// | |
// ... and so on. | |
export const reset = "\x1b[0m" | |
export const bright = "\x1b[1m" | |
export const dim = "\x1b[2m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ZSH="$HOME/.oh-my-zsh" | |
ZSH_THEME="powerlevel9k/powerlevel9k" | |
. ~/.zshtheme | |
ENABLE_CORRECTION="true" | |
COMPLETION_WAITING_DOTS="true" | |
plugins=( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class Abstract { | |
// A static abstract method. | |
static foo() { | |
if (this === Abstract) { | |
// Error Type 2. Abstract methods can not be called directly. | |
throw new TypeError("Can not call static abstract method foo."); | |
} else if (this.foo === Abstract.foo) { | |
// Error Type 3. The child has not implemented this method. | |
throw new TypeError("Please implement static abstract method foo."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "create new version of nativefier-wrokchat" | |
nativefier -i ./workplace.png https://fb.workplace.com -n nativefier-workchat | |
if [ -d "/Applications/nativefier-workchat.app" ]; then | |
echo "backup..." | |
mv /Applications/nativefier-workchat.app ~/Desktop/nativefier-workchat-backup.app | |
echo "done => ~/Desktop" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# file: ttfb.sh | |
# curl command to check the time to first byte | |
# ** usage ** | |
# 1. ./ttfb.sh "https://google.com" | |
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com" | |
curl -o /dev/null \ | |
-H 'Cache-Control: no-cache' \ | |
-s \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ENV_PATH="$(dirname "$(dirname "$(which pip)")")" | |
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)" | |
echo "Ensure the root of current virtualenv:" | |
echo " $ENV_PATH" | |
read -p "‼️ Say no if you are not sure (y/N) " -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]]; then | |
echo "♻️ Removing old symbolic links......" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Determines the "branch" of the current repo and emits it. | |
# For use in generating the prompt. | |
# This is portable to both zsh and bash and works in both | |
# git and mercurial repos and aims to avoid invoking the | |
# command line utilities for speed of prompt updates | |
# To use from zsh: | |
# NOTE! the single quotes are important; if you use double quotes | |
# then the prompt won't change when you chdir or checkout different | |
# branches! |
NewerOlder