Skip to content

Instantly share code, notes, and snippets.

View gwpl's full-sized avatar

Grzegorz Wierzowiecki gwpl

  • Europe - usually: Zürich, Warsaw or Berlin
View GitHub Profile

Keybase proof

I hereby claim:

  • I am gwpl on github.
  • I am gwpl (https://keybase.io/gwpl) on keybase.
  • I have a public key ASCSgZW4fP-pVrJ8zG0GbajAW_pSNWHrZjkhXWCYxS2fZAo

To claim this, I am signing this object:

@gwpl
gwpl / NEW QGROUP!.md
Created December 15, 2017 18:21 — forked from mazgi/NEW QGROUP!.md
Btrfs subvolume quota
[root@btrfs-testdrive] # btrfs qgroup create 1/100 /mnt/btrfs
[root@btrfs-testdrive] # btrfs qgroup assign 0/276 1/100 /mnt/btrfs
[root@btrfs-testdrive] # btrfs qgroup show /mnt/btrfs
qgroupid rfer       excl       
-------- ----       ----       
0/5      16384      16384      
0/256    2864136192 2864136192 
0/258    833703936  833703936  
0/259    52510720   52510720   
@gwpl
gwpl / 2017-12-14-btrfs-try-to-btrfs-quota-qgroup.sh
Last active December 15, 2017 19:26
2017-12-14 Playing with BTRFS quota limits - Grzegorz Wierzowiecki
#!/bin/bash
# 2017-12-14 Playing with BTRFS quota limits - Grzegorz Wierzowiecki
# gist:
# Below script is prepared for easy experimentation, and should run copy-and-paste
# (you need permissions to create lvm groups, etc. therefore root)
# It
# * setup 128MiB btrfstest in selected volume group
# * setup quotas (32MiB and 64MiB) and test them
# * cleanup
# Helpful references:
@gwpl
gwpl / 2017-12-15-xattr-Semantic_Desktop_File_tagging.sh
Last active December 15, 2017 22:54
2017-12-15 xattr command line Semantic Desktop Style File Tagging
# 2017-12-15 xattr command line Semantic Desktop Style File Tagging
# this gist: https://gist.github.com/gwpl/a00e18bc150f1e3518335d13c5e46ad7
# Perform on xattr filesystem:
setfattr -n user.xdg.tags -v "foo,bar" file.png
setfattr -n user.xdg.comment -v "example comment" file.png
setfattr -n user.baloo.rating -v "10" file.png
getfattr -d file.png
# Screenshot how it looks like in Dolphin GUI : https://imgur.com/oguuJNm
@gwpl
gwpl / inotify_exec_on_file_change.sh
Created May 16, 2017 23:01
inotifywait to exec specified command on each file change -> e.g. run "make", "pdflatex", or any other compile/upload or other command of choice! (Thanks https://superuser.com/a/181543/81861 ! )
#!/bin/bash
# Example usecase:
# inotify_exec_on_file_change.sh /path/phd paper.tex pdflatex paper.tex
dirn="$1"
filen="$2"
shift 2
echo "Watching directory $dirn for changes of file $filen . Watching directory insteaf of file to overcome behaviour of many text editors that replace file - Thanks to Giles and see his answer https://superuser.com/a/181543/81861 for more details. In case of matching even I execute:" $@
@gwpl
gwpl / cc-by-sa-ver4.0.html
Created May 2, 2018 08:28
HTML snippet for Creative Commons Attribution-ShareAlike 4.0 International License.
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" />
</a><br />
<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Dataset"
property="dct:title" rel="dct:type">${title}</span>
by
<a xmlns:cc="http://creativecommons.org/ns#" href="${authors_url}" property="cc:attributionName"
rel="cc:attributionURL">${aurhor_name}</a>
is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
@gwpl
gwpl / svg_path.html
Created May 31, 2018 10:40
w3schools example : svg_path with absolute coordinates Q instead of relative q for curve
Converted w3schools example from relative "q" to absolute "Q" to make it more readiable according to controlpoints A,B,C.
<br/>
<svg height="400" width="450">
<path id="lineAB" d="M 100 350 l 150 -300" stroke="red" stroke-width="3" fill="none" />
<path id="lineBC" d="M 250 50 l 150 300" stroke="red" stroke-width="3" fill="none" />
<path d="M 175 200 l 150 0" stroke="green" stroke-width="3" fill="none" />
<path d="M 100 350 Q 250 50 400 350" stroke="blue" stroke-width="5" fill="none" />
<!-- Mark relevant points -->
<g stroke="black" stroke-width="3" fill="black">
@gwpl
gwpl / bash coloring handy functions
Created November 11, 2018 09:28
bash coloring handy functions
# source: https://stackoverflow.com/a/20910449/544721
norm="$(printf '\033[0m')" #returns to "normal"
bold="$(printf '\033[0;1m')" #set bold
red="$(printf '\033[0;31m')" #set red
boldred="$(printf '\033[0;1;31m')" #set bold, and set red.
somecommand | sed -e "s/someregexp/${boldred}&${norm}/g" # will color any occurence of someregexp in Bold red
printf "%s" "$red" ; locate something ; printf "%s" "$norm" # will color output of locate something in red
@gwpl
gwpl / odtgrep.sh
Last active November 11, 2018 09:55
grepping odt files
#!/bin/bash
# Usage:
# odtgrep.sh IamSearchingThis *.odt
# find -name '*.odt' -exec odtgrep.sh IamSearchingThis "{}" \;
# or
# odtgrep.sh -C 5 IamSearchingThis *.odt
# find -name '*.odt' -exec odtgrep.sh -C 5 IamSearchingThis "{}" \;
#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