Skip to content

Instantly share code, notes, and snippets.

View fpietka's full-sized avatar

François Pietka fpietka

View GitHub Profile
@fpietka
fpietka / gist:0e2419364ad74de3e3275167cd161267
Created August 31, 2016 11:54 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

@fpietka
fpietka / json_manipulator.sql
Created July 10, 2016 15:33 — forked from matheusoliveira/json_manipulator.sql
Simple PostgreSQL functions to manipulate json objects. (Note: performance is not a concern for those functions)
CREATE OR REPLACE FUNCTION public.json_append(data json, insert_data json)
RETURNS json
IMMUTABLE
LANGUAGE sql
AS $$
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json
FROM (
SELECT * FROM json_each(data)
UNION ALL
SELECT * FROM json_each(insert_data)

Keybase proof

I hereby claim:

  • I am fpietka on github.
  • I am fpietka (https://keybase.io/fpietka) on keybase.
  • I have a public key ASC58_VWQjcimGxLsE8kiz-XN4yfw4l0h9NEEWxLKCcSdAo

To claim this, I am signing this object:

#!/bin/bash
# Renames subtitles files according to tv shows names found in a directory
# Acceped syntaxes for season/episode are: 304, s3e04, s03e04, 3x04 (case insensitive)
#
# Usage:
# Put this gist somewhere in your $PATH, like /usr/local/bin/subtitles-renamer
# Chmod +x it
# cd ~/YourHolidaysTvShowsWithSubtitles
# subtitles-renamer
@fpietka
fpietka / sound
Created January 14, 2015 10:58
Sound control with amixer and pulse
#!/bin/bash
if [ -z $1 ]
then
exit 0
fi
[[ `amixer -D pulse get Master | egrep 'Playback.*?\[o' | egrep -o '\[o.+\]'` == *"off"* ]] && MUTED=true || MUTED=false
if [ $1 == "mute" ]
#!/bin/bash
while read oldrev newrev refname
do
forced=$(git rev-list $oldrev ^$newrev 2>/dev/null)
if [[ $refname = "refs/heads/master" ]] && [[ ! -z $forced ]]; then
echo >&2 "Forced push not allowed on master branch!"
exit 1
fi
done
@fpietka
fpietka / post-merge
Created October 22, 2013 13:13
Post merge hook for versioned config file into not versioned one
#!/bin/sh
DEV_CONFIG_FILE=config.php-dev
CONFIG_FILE=config.php
MODIFIED_FILES=$(git diff --name-only HEAD@{1} HEAD)
for MODIFIED_FILE in $MODIFIED_FILES; do
if [ $DEV_CONFIG_FILE = $MODIFIED_FILE ]; then
echo
echo "-------------------------------------"
echo "Config file modified, need to update!"