Skip to content

Instantly share code, notes, and snippets.

View filviu's full-sized avatar

Silviu Vulcan filviu

View GitHub Profile
@filviu
filviu / .bashrc.local
Created October 29, 2021 09:38
SSH_AUTH_SOCK with remote desktop and vscode
# make sure your .bashrc actually loads a .bashrc.local
if [ "$TERM_PROGRAM" != "vscode" ]; then
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
fi
@filviu
filviu / get-hugo.sh
Created October 11, 2021 09:22
Install hugo binary
#!/bin/bash
tempdir=$(mktemp -d)
cd $tempdir
curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "browser_download_url.*Linux-64bit.tar.gz"|grep -v extended | cut -d : -f 2,3 | tr -d \" | wget -qi -
tar -xf $(ls -1 *.tar.gz)
mv hugo ~/bin/
cd -
rm -rf $tempdir
@filviu
filviu / update-rclone.sh
Created October 11, 2021 09:18
Update rclone to latest amd64 version.
#!/bin/bash
CURDIR="$(pwd)"
TMPDIR="$(mktemp -d)"
cd $TMPDIR
wget https://downloads.rclone.org/rclone-current-linux-amd64.deb
dpkg -i rclone-current-linux-amd64.deb
cd "${CURDIR}"
rm -rf "${TMPDIR}"
@filviu
filviu / update-hcloud.sh
Created October 11, 2021 09:17
update hetzner cli to latest version
#!/bin/bash
hcloud version
temp_dir=$(mktemp -d)
cd $temp_dir
wget https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz
tar -xf hcloud-linux-amd64.tar.gz
mv hcloud ~/bin/
cd -
rm -rf $temp_dir
hcloud version
@filviu
filviu / rm_jpg.sh
Created October 11, 2021 09:13
Move jpeg files to a subfolder if an identical named RAW faile exists. Rename CR2 to particular RAW
#!/bin/bash
ls -1 *.JPG | while read filename; do
extension="${filename##*.}"
filename="${filename%.*}"
if [ -f "${filename}.CR2" ]; then
#echo "${filename}"
mkdir -p t
mv "${filename}.JPG" t/
fi
@filviu
filviu / myepisodes-aquired.php
Created October 11, 2021 09:07
PHP scripts to mark episodes as aquired and as played on myepisodes.com
#!/usr/bin/env php
<?php
# run from sonarr to mark episode as aquired on myepisodes.com
# use for debuging when running from sonarr
#fclose(STDIN);
#fclose(STDOUT);
#fclose(STDERR);
#$STDIN = fopen('/dev/null', 'r');
#$STDOUT = fopen('/tmp/application.log', 'wb');
@filviu
filviu / vob2mkv.sh
Created September 1, 2021 10:58
broken vob to mkv
#!/bin/bash
# concatenate
cat *.VOB > output.vob
# find streams
ffmpeg -i output.vob
# find missing subs
ffmpeg -analyzeduration 100M -probesize 100M -i output.vob
@filviu
filviu / update-hcloud.sh
Created July 19, 2021 10:03
Update the hcloud cli binary to the latest version
#!/bin/bash
hcloud version
temp_dir=$(mktemp -d)
cd $temp_dir
wget https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz
tar -xf hcloud-linux-amd64.tar.gz
mv hcloud ~/bin/
cd -
rm -rf $temp_dir
hcloud version
@filviu
filviu / 01-autologin.conf
Created January 15, 2021 13:55
Lightdm autologin without modifying lightdm.conf. Add in /etc/lightdm/lightdm.conf.d
[Seat:*]
autologin-user=USER
autologin-timeout=0
@filviu
filviu / gist:b90942bea74fe64c4a8d08231fea4591
Created September 22, 2020 13:22 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.