Skip to content

Instantly share code, notes, and snippets.

Grzegorz Wierzowiecki gwpl

Block or report user

Report or block gwpl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View clear_git_backup_after_rewrite.sh
# solution from https://blog.tinned-software.net/rewrite-author-of-entire-git-repository/
git fetch origin
git reset --hard origin/master
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
@gwpl
gwpl / collapsible_list.html
Last active Mar 27, 2019
Answer: https://stackoverflow.com/a/55377750/544721 ← there is a video to see how it works! It is list expandable html5 <details> <summary> (checked with https://validator.w3.org/nu/#textarea , clean on 2019-03-27)
View collapsible_list.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Details/summary opened with anchor via javascript</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script language='JavaScript' type='text/JavaScript'>
function MakeArrayOfAllPrefixes(str){
//console.log("MakeArrayOfAllPrefixes("+str+")");
var prefixes = [];
@gwpl
gwpl / chromium_profile_by_topic.sh
Last active Mar 15, 2019
Use different chromium profiles for different activities! Enjoy lightweight chrome, that has to carry only what it needs for task, plus more order as keeping separated different interested and activities (of sets of extensions) for order :).
View chromium_profile_by_topic.sh
#!/bin/bash
chromium_profiles_dir="$HOME/.config/chromium_profiles/"
mkdir -p "$chromium_profiles_dir"
# echo "$ ls -1 $chromium_profiles_dir"
# select profile in "$(ls "$chromium_profiles_dir")" "make_new"; do break; done
# echo $profile
# if [ "$profile" == "make_new" ]; then
# read -p "Profile name (preferably no spaces):" profile
@gwpl
gwpl / How to play linux default audio output on Sonos speakers (with delay using http streaming).md
Last active Jan 26, 2019
How to play linux default audio output on Sonos speakers (with delay using http mp3 or flac streaming)
View How to play linux default audio output on Sonos speakers (with delay using http streaming).md

how tu setup pulseaudio->streaming via cvlc (command line vlc -> so should simmilarily work with gui version (in my case don't)): https://superuser.com/a/1021823/81861

get pulseaudio source from list:

pactl list | grep "Monitor Source"

and assign to P , e.g. in my case it's usually:

@gwpl
gwpl / repeat
Last active Jan 12, 2019
repeat command in bash n times ( answer https://unix.stackexchange.com/a/494158/9689 )
View repeat
#!/bin/bash
n=$1
shift 1
for ((x=0; x<$n; ++x)); do
"$@"
done
@gwpl
gwpl / rmlint_example_run_stats.txt
Last active Jan 1, 2019
rmlint some example run tests statistics
View rmlint_example_run_stats.txt
$ find -type d | wc -l
875
$ file | wc -l
11376092
$ time rmlint -o sh:stdout -c sh:hardlink|tee >( xz > rmlint.sh.xz )
real 1447m43.626s
user 661m13.740s
sys 98m40.956s
$ ls -lha rmlint.sh.xz
-rw-r--r-- 1 user user 49M Dec 27 06:38 rmlint.sh.xz
@gwpl
gwpl / rotate_video.md
Last active Dec 25, 2018
rotate video cli linux commandline
View rotate_video.md

from : https://www.thelinuxblog.com/rotating-videos-in-linux/

mencoder -ovc lavc -vop rotate=1 -oac copy input.mpg -o output.mpg
  • 0 Rotate by 90 degrees clockwise and flip (default).
  • 1 Rotate by 90 degrees clockwise.
  • 2 Rotate by 90 degrees counterclockwise.
  • 3 Rotate by 90 degrees counterclockwise and flip.

on my experience you need to change -vop flag with -vf

@gwpl
gwpl / rmlint_example_usage.sh
Last active Dec 25, 2018
rmlint_example_usage.sh
View rmlint_example_usage.sh
# more info: https://rmlint.readthedocs.io/en/latest/tutorial.html?highlight=hardlink
# generate script that hardlinks (if you have btrfs or other CoW use reflink or clone)
#rmlint -o sh:rmlint.sh -c sh:hardlink # <- for small outputs
rmlint -o sh:stdout -c sh:hardlink|tee >( xz > rmlint.sh.xz ) # <- for big outputs
#with -p -> paranoia , check files again before removing
./rmlint.sh -x -p
@gwpl
gwpl / watchdog.sh
Created Dec 10, 2018
Checks if amount of files in directory has changed, if not than it executes killall to let thing restart in a loop
View watchdog.sh
#!/bin/bash
counterf=no_of_files_last_time.txt
tmpf="$(mktemp)"
counter_old="$(cat "$counterf")"
echo -n 'Missing: '
comm -23 <(sort -u sites_source.txt) <(ls -1|sort -u)|wc -l
echo -n 'Total: '
sort -u sites_source.txt|wc -l
View gist:0bf0d8f9aa9385207d3636d130739f10
#cli #linux #snippet
# find lines only in file1
comm -23 file1 file2
# find lines only in file2
comm -13 file1 file2
# find lines common to both files
comm -12 file1 file2
You can’t perform that action at this time.