Skip to content

Instantly share code, notes, and snippets.

@nickistre
nickistre / 90-flashcache-home.conf
Last active November 2, 2015 14:21
Flashcache Home settings example - Kubuntu 15.04
#######################
# Flashcache settings #
#######################
# Save at /etc/sysctl.d/90-flashcache-home.conf
# Setup changes for home mounted flashcache
# Change reclaim policy to LRU
dev.flashcache.sdc3+9d2bd66e-d2d8-4e6d-a971-613bd7c7e0be.reclaim_policy=1
@nickistre
nickistre / vid_concat.sh
Last active July 25, 2017 05:31
Common Video conversion tools on Ubuntu-based systems
#!/bin/env bash
# The following is to combine all mp4 files (such as from a GoPro action cam) in the current directory into one
# large file for processing. Note that audio is converted from whatever compressed form to uncompressed PCM!
# Change the filenames to order them in alpha-numeric form.
mencoder -oac pcm -ovc copy -idx -o full.mp4 *.MP4

Keybase proof

I hereby claim:

  • I am nickistre on github.
  • I am nickistre (https://keybase.io/nickistre) on keybase.
  • I have a public key ASBTGJdnJi3MmfI0twBlRQR4IYal_JqGydn4SkGljk6eUgo

To claim this, I am signing this object:

@nickistre
nickistre / docker-reset-full-single-line.sh
Last active July 24, 2023 22:45
Reset Docker environment
#!/usr/bin/env bash
# All in one line
docker stop $(docker ps -q) ; docker rm $(docker ps -aq) ; docker rmi -f $(docker images -q) ; docker volume prune -f ; docker network prune -f ; docker system prune -a --volumes -f
@nickistre
nickistre / start-mysql-docker.sh
Last active December 14, 2020 06:09
A couple of scripts to run Databases in local Docker containers for testing
#!/usr/bin/env bash
# From: https://stackoverflow.com/a/46625302
function getContainerHealth {
docker inspect --format "{{json .State.Health.Status }}" $1
}
function waitContainer {
while STATUS=$(getContainerHealth $1); [ $STATUS != "\"healthy\"" ]; do
if [ $STATUS == "\"unhealthy\"" ]; then
@nickistre
nickistre / PHPUnitHTMLCheck.php
Last active July 20, 2020 21:32
PHPUnit snippet for checking if a string is valid HTML using DOMDocument at a basic level.
protected function checkHTML($body)
{
libxml_use_internal_errors(true);
$dom = new \DOMDocument();
$dom->loadHTML($body, LIBXML_HTML_NOIMPLIED + LIBXML_HTML_NODEFDTD);
// Check for no errors
$this->assertCount(0, libxml_get_errors());
// Check for doctype
@nickistre
nickistre / .gitignore-mac-os-x
Created December 5, 2020 19:43
Common global .gitignore files
# Copy this into ~/.gitignore and run the following:
# git config --global core.excludesfile ~/.gitignore
# Folder view configuration files
.DS_Store
Desktop.ini
# Thumbnail cache files
._*
Thumbs.db
@nickistre
nickistre / .bashrc-ubuntu
Last active December 24, 2020 19:23
Setup BASH Prompt for just showing parent directory
# In `~/.bashrc`, add or change to the following:
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
@nickistre
nickistre / run_as_user_setup_source.sh
Last active April 25, 2024 18:41
Helper script to have apps in docker run as user and group of project folder.
# Add to Docker image and include in other scripts with (using the current directory
# for the user_id and group_id):
# source /path/to/run_as_user_setup_source.sh "$(pwd)"
# Requires commands:
# sudo
# Tested on BASH
# Run apps or scripts as the user of the used directory with:
@nickistre
nickistre / gist:b9922e2b182ed2816468cfb23f821235
Last active August 23, 2021 02:23
Steam Crash Log - Manjaro - 2021-08-22
>>> Adding process 127220 for game ID 284160
>>> Adding process 127223 for game ID 284160
>>> Adding process 127222 for game ID 284160
sh: 1: lsb_release: not found
>>> Adding process 127224 for game ID 284160
>>> Adding process 127226 for game ID 284160
>>> Adding process 127227 for game ID 284160
>>> Adding process 127228 for game ID 284160
>>> Adding process 127229 for game ID 284160
sh: 1: lsb_release: not found