Skip to content

Instantly share code, notes, and snippets.

View dwin's full-sized avatar
🎯
Focusing

Darwin Smith dwin

🎯
Focusing
View GitHub Profile
@dwin
dwin / convert.sh
Created January 6, 2019 08:41
Convert all Plex DVR recordings in directory to HEVC/x265
#!/bin/sh --
# Make executable and Run in directory containing files?
# Convert all '.ts' files in directory using ffmpeg using nvidia hardware hevc(x265) encoding, maintain orginal audio
# and extract subtitles/closed-caption as '.srt' to current directory.
# Start looping over files, tell what we do and log any output to screen and log.
for MPEG in *.ts; do echo "Starting ${MPEG}"
ffmpeg -i "${MPEG}" -c:a copy -c:v hevc_nvenc -b:v 3000k -minrate 1000k -maxrate 8000k -level 4.1 -tag:v hvc1 -preset slow -rc-lookahead 32 -movflags faststart "${MPEG%.ts}.mp4" 2>&1 | tee -a "conversion.log"
# If ffmpeg exited OK, then say it and move the original to the backup directory.
if [ $? -eq 0 ]; then
@dwin
dwin / Instructions.md
Created March 14, 2023 21:16
Duplicacy Install as Linux Service

Installing Duplicacy as a Service on Linux

Ubuntu 22.04 LTS

Using Download link from https://duplicacy.com/download.html

Download and Verify Duplicacy web binary.

wget https://acrosync.com/duplicacy-web/duplicacy_web_linux_x64_1.6.3 -O duplicacy_web
@dwin
dwin / accesslog2csv.pl
Created September 2, 2021 03:07 — forked from sepehr/accesslog2csv.pl
Perl: Convert Apache access log to CSV
#!/usr/bin/perl
#
# @file
# Converter tool, from Apache Common Log file to CSV.
#
# All code is released under the GNU General Public License.
# See COPYRIGHT.txt and LICENSE.txt.
#
@dwin
dwin / bookIndex.js
Created October 2, 2015 17:32
Function that given a sorted array of page numbers, returns a string representing a book index. Combines consecutive pages to create ranges. Given [1,3,4,5,7,8,10] it should return the string “1, 3-5, 7-8, 10”.
var arr = [1,2,3,5,8,10,11,12,15]
function bookIndex(arr) {
var temp = [];
for (var i = 0; i < arr.length; i++) {
if (arr[i]+1 == arr[i+1]) {
var start = arr[i];
while (arr[i]+1 == arr[i+1]) {
i++;
}
@dwin
dwin / linux free disk space.txt
Created July 21, 2020 02:35
Get Free Disk Space Linux excluding tmp directories
df -h -x tmpfs -x devtmpfs
@dwin
dwin / docker-compose.yml
Created May 11, 2019 00:58 — forked from mhowlett/docker-compose.yml
Brings up a kafka cluster using Docker for Mac. Usage: MY_IP=<your ip> docker-compose up
---
version: '2'
services:
zk1:
image: confluentinc/cp-zookeeper:3.0.1
ports:
- "22181:22181"
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 22181
@dwin
dwin / generate_random_string.go
Last active February 14, 2019 21:51
Generate Random String in Go
//
// Do Use This the generated string is not very random at all
//
package main
import (
"fmt"
"math/rand"
"time"
)
@dwin
dwin / drone.yml
Created January 11, 2019 18:26
Drone Secrets Definition
test:
image: golang:alpine
secrets:
- source: token
target: TOKEN
environment:
# TOKEN:
commands:
- apk add --update bash ca-certificates build-base
@dwin
dwin / keybase.md
Last active July 2, 2018 20:32
Keybase Proof

Keybase proof

I hereby claim:

  • I am dwin on github.
  • I am dwins (https://keybase.io/dwins) on keybase.
  • I have a public key ASCJnQAtZ0puYoFAd2rVUy8UJamdLxRHLv1yqjyL7Tyoago

To claim this, I am signing this object:

@dwin
dwin / Search.java
Last active August 18, 2017 02:09
Sequential vs Jump Search Algoritm for finding key digits in sorted numerical array
/*
* Dwin
*
*/
// Search ordered numerical array for specified numerical keys
public class Search {
static int[] arr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 19, 21, 25, 28, 31, 34, 36, 37, 38, 43, 49, 52, 53, 55, 60, 66, 69, 72, 81, 89, 110, 115, 116, 123, 144, 167, 182, 199, 233, 302, 320, 377, 462, 510, 540, 610, 630, 641, 666, 671, 695, 713, 715, 732, 754, 769, 856, 875, 900, 905, 915};
static int[] key = {0, 16, 116, 302, 610, 666, 900};
public static void main(String[] args) {