Skip to content

Instantly share code, notes, and snippets.

View dac73's full-sized avatar
Ship it

Dario Tislar dac73

Ship it
  • Digital Cloud Consulting ltd
  • Croatia
View GitHub Profile
@dac73
dac73 / fedora_fonts.sh
Created March 26, 2020 19:10
Fedora nicer font rendering
#!/usr/bin/env bash
sudo ln -s /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/10-hinting-slight.conf
sudo ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/10-sub-pixel-rgb.conf
sudo ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/11-lcdfilter-default.conf
@dac73
dac73 / .bashrc
Last active December 6, 2020 17:11
Fancy PS1 (bash) prompt with git, python venv, background jobs and exit code, multiline
# paste this code in ~/.bashrc
# example --> https://i.imgur.com/EJvWE5Y.png
# lets create functions for PS1 segments
GITCOLOR=34
VENVCOLOR=5
function segment_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
@dac73
dac73 / mellowplayer-flatpak-update.sh
Created August 27, 2019 11:59
Update MellowPlayer flatpak
#!/bin/bash
set -e
NEW_VERSION=`curl -s https://gitlab.com/api/v4/projects/9602590/releases | jq -r '.[0].name'`
CURRENT_VERSION=`com.gitlab.ColinDuquesnoy.MellowPlayer -v 2>&1 /dev/null | grep -i MellowPlayer | cut -d' ' -f2-`
echo -e "Local Version: \e[95m$CURRENT_VERSION\e[0m Remote Version: \e[95m$NEW_VERSION\e[0m"
if [[ ${NEW_VERSION:0:5} == ${CURRENT_VERSION:0:5} ]]; then
echo "Update not needed!"
exit
fi
@dac73
dac73 / 99-hack-color-emoji.conf
Last active May 25, 2022 14:16 — forked from IgnoredAmbience/99-noto-mono-color-emoji.conf
Hack Emoji Color fontconfig for Konsole
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
Noto Mono + Color Emoji Font Configuration.
Currently the only Terminal Emulator I'm aware that supports colour fonts is Konsole.
Usage:
0. Ensure that the Noto fonts are installed on your machine.
1. Install this file to ~/.config/fontconfig/conf.d/99-hack-color-emoji.conf
@dac73
dac73 / gist:0bee407324a25e88257b545f603eb794
Last active July 17, 2019 10:36
Wordpres http > https mysql query
UPDATE wp_options SET option_value = replace(option_value, 'http://www.foo.bar', 'https://www.foo.bar') WHERE option_name = 'home' OR option_name = 'site url';
UPDATE wp_posts SET guid = replace(guid, 'http://www.foo.bar','https://www.foo.bar');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.foo.bar', 'https://www.foo.bar');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.foo.bar','https://www.foo.bar');
@dac73
dac73 / ubuntu_openvpn.md
Created April 18, 2019 20:58
Ubuntu Openvpn problems

At end of commands

script-security 2
up /etc/openvpn/update-systemd-resolved
down /etc/openvpn/update-systemd-resolved
down-pre

At end of file

dhcp-option DOMAIN-ROUTE .
It's quiet easily hackable if you only need opencl support. There is no need to install the complete driver. Download the latest AMDGPU-PRO driver and extract the whole package. From the extracted packages you need to put the following files in specific folders ( /opt/amdgpu-pro in my example) :
/opt/amdgpu-pro/share/libdrm/amdgpu.ids
/opt/amdgpu-pro/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0
/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl64.so
/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl12cl64.so
@dac73
dac73 / postgres.sql
Last active March 14, 2019 10:35
Postgres
-- table sizes real/sys
SELECT
relname as "Table",
pg_size_pretty(pg_total_relation_size(relid)) As "Size",
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid)) as "External Size"
FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC;
-- more details on size
SELECT
relname as "Table",

network problems:

 add rc-manager=symlink to [main] section in 
 /etc/NetworkManager/NetworkManager.conf, 
 remove /etc/resolv.conf and restart NetworkManager (systemctl restart NetworkManager). 
 This way resolv.conf will be managed by NetworkManager instead of netconfig

screen tearing on intel:

first install xf86-video-intel
@dac73
dac73 / MacOS.sh
Created December 9, 2018 19:37
OSx private DNS in AWS VPC resolving
networksetup -setdnsservers Wi-Fi {X.X.X.}2 8.8.8.8
# Replace {X.X.X.} with VPC subnet