Skip to content

Instantly share code, notes, and snippets.

@gotofritz
gotofritz / resize padded.sh
Last active June 26, 2019 13:35
ImageMagick bits and pieces
# resize image, padded
@gotofritz
gotofritz / find-by-number-of-lines.sh
Last active November 13, 2016 17:10
various bash find command
#sort files by number of lines
find /path/to/folder -name '*.js' | xargs wc -l | sort
@gotofritz
gotofritz / random_color.js
Last active September 8, 2016 06:37
random color
//random color
//from: http://www.mrspeaker.net/2013/03/08/random-hex-colour/
//16777216 = 1 << 24
// ES5
function random_color(){
return '#'+ ( '00000' + ( Math.random() * 16777216 | 0 ).toString( 16 ) ).slice( -6 );
}
// ES6
@gotofritz
gotofritz / prevent-select.css
Created October 9, 2013 11:44
for touch devices, disables selection
.preventSelect {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
@gotofritz
gotofritz / _html5.html
Last active December 25, 2015 06:29
Minimal HTML documents
<!DOCTYPE html>
<html lang="en">
<head>
<!-- charset always before title to avoid UTF-7 exploits -->
<meta charset="utf-8">
<title>title</title>
<link rel="stylesheet" href="css.css">
</head>
<body>
@gotofritz
gotofritz / .Git bits and pieces
Last active August 22, 2017 18:33
Git bits and pieces
# Bulk Resolve Conflics
# Changing username after a commit
# Compare Versions
# Delete A Branch
# Empty Dirs
# Get Info
# Ignore A File That Was Already Pushed
# Log With Actual Changes
# Log With List Of Files
# Move Commits To Another Branch
@gotofritz
gotofritz / npm-list.sh
Last active October 19, 2017 09:46
NPM bits and pieces
# given that $PACKAGE is the package about which you want to find out more
# this lists only the modules you have installed
npm ls
# list available versions of $PACKAGE
# note the plural, versionS - without it, you only get the current version
npm show $PACKAGE versions
# this finds the latest version of your package as well as other with similar names
@gotofritz
gotofritz / _ffmpeg.sh
Last active June 26, 2019 13:58
Various ffmpeg commands
# ffmpeg snippets
# ffmpeg-slowdown.sh: slow down all files in a directory
# ffmpeg-to-mp3.sh: convert all video files in a directory to mp3
# handbrake-bulk.sh: convert all webm fils in a folder to mp4
@gotofritz
gotofritz / lazydocker config.yml
Created October 16, 2019 13:52
lazydocker add
# ~/Library/Application\ Support/jesseduffield/lazydocker/config.yml
reporting: "on"
customCommands:
services:
- name: start
attach: false
command: docker-compose up -d {{ .Service.Name }}
@gotofritz
gotofritz / Makefile
Last active November 6, 2023 18:41
Starting point for Python Makefile for Poetry
PYTHON_VERSION ?= 3.10.4
CMD := poetry run
SRC_DIR := src
TESTS_DIR := tests
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: help
lint-mypy: ## checks src and tests with mypy