Skip to content

Instantly share code, notes, and snippets.

@calvine
calvine / ffmpeg.ref
Last active February 24, 2021 15:50
FFMPEG Command Examples
# speed up video
ffmpeg.exe -i .\output_1.mp4 -filter:v "setpts=0.1*PTS,fps=30" output_1_fast.mp4
# concatenate videos
ffmpeg.exe -f concat -safe 0 -i files__.txt -c:v copy timelapse_1.mp4
# powershell get all files names in date order to file
Get-ChildItem -Path . | Sort-Object -Property LastWriteTime | Select-Object -Property Name | Out-File .\files__.txt
# overkill powershell to get all files from a directory with a given file extension order by last write time in expected FFMPEG format
Set-Variable -Name "target_file" -Visibility Public -Value "./timelapse_files.txt"; Get-ChildItem -Path "Z:\Videos\Grow_Footage\Sunflower_feb_2021\DCIM\Timelapse_footage\100GOPRO" | Where-Object {$_.Name -like "*.mp4"} | Sort-Object -Property LastWriteTime | Select-Object -ExpandProperty FullName | ForEach-Object -Begin {Write-Host "Starting Loop"; Remove-Item $target_file -Force; New-Item $target_file -ItemType "file"} -Process { Write-Host $target_file; Add-Content -Path $target_file -Encoding Ascii -Value $("file '{0}'"
@calvine
calvine / docker stuff.txt
Last active April 28, 2021 20:14
Create temp postgres database with docker
docker container run -p 5432:5432 -e POSTGRES_PASSWORD=password1 -e POSTGRES_USER=postgres -e PGDATA=/var/lib/postgresql/data --rm --name postgres -v postgres:/var/lib/postgresql/data postgres:latest
# https://hub.docker.com/_/couchdb
docker container run -d --name test_couchdb -p 5984:5984 -v /home/couchdb/data:/opt/couchdb/data -v /home/couchdb/etc:/opt/couchdb/etc/local.d -e COUCHDB_USER=root -e COUCHDB_PASSWORD=password couchdb:3.1.1
@calvine
calvine / index.js
Created February 13, 2021 17:32
Integer to Roman Numeral in JavaScript
const {intToRoman} = require("./int-to-roman");
const input = process.argv[process.argv.length-1];
console.log(`${input} => ${intToRoman(input)}`);
# neo4j
docker run -p 7474:7474 -p 7687:7687 --env=NEO4J_AUTH=none --name neo4j -v C:\\neo4j\\data:/data neo4j
#mongodb
docker container run -p 27017:27017 --name mongodb -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=password -e MONGO_INITDB_DATABASE=testdb -v mongovolume:/data/db mongo
docker container create --name mongo -p 27017:27017 --net test_network --env MONGO_INITDB_ROOT_USERNAME=root --env MONGO_INITDB_ROOT_PASSWORD=password --env MONGO_INITDB_DATABASE=testdb --volume mongo_storage:/data/db mongo:latest
@calvine
calvine / publish.ps1
Created October 23, 2019 02:52
dotnet 3.0 single file publish command
dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true
from gpiozero import LED, Button
from time import sleep
from signal import pause
led_green = LED(2)
led_yellow = LED(3)
led_red = LED(4)
button = Button(14)
@calvine
calvine / camelCaseConvert.js
Created April 7, 2019 18:34
This is a simple JS function that takes in a camel case string and converts it to a string with spaces between the works and each word capitalized.
/**
* Takes in a camel case string and splits and capitalizes each word.
* @param {String} propertyName
* @returns {String}
*/
static getDisplayNameFromPropertyName(propertyName) {
// Set the first character to upper case.
let displayName = propertyName.charAt(0).toUpperCase() + propertyName.slice(1).replace(/[A-Z]/g, " $&");
console.log(displayName);
return displayName;
@calvine
calvine / svgtopng.bat
Created April 2, 2019 19:10
Using http://www.imagemagick.org tool to batch convert SVGs to PNGs
magick convert *.svg -set filename:f %t %[filename:f].png
@calvine
calvine / MainFragment.Java
Created December 3, 2018 05:47
Quick Android Example of Viewmodels and using them in databinding
package com.example.ui.main;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProviders;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@calvine
calvine / SpeechSynthesis_Explorer.html
Last active March 13, 2017 15:45
Exploring HTML 5 SpeechSynthesis! (TTS)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--
SpeechSysthesis Resource Links.
http://caniuse.com/#feat=speech-synthesis
https://www.w3.org/TR/speech-synthesis