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 / s3.sh
Last active December 10, 2018 04:57
aws cli
# get latest objects from S3 bucket
aws s3api list-objects --bucket {S3-bucket-name} --query "Contents[?LastModified>=\`$(date +%Y-%m-%d)\`][]"
@dac73
dac73 / python3.py
Last active October 19, 2018 15:14
python shenanigans
# upload artifact to nexus3 via python
artifact_name=os.path.basename(zipped_log_file)
headers = {'Content-Type': 'application/binary'}
with open(zipped_log_file, 'rb') as artifact:
requests.put(nexus_url + '/' + artifact_name, headers=headers,
data=artifact, auth=(nexus_username, nexus_password))
# get pip for python36 on f29+
wget https://bootstrap.pypa.io/get-pip.py
python3.6 get-pip.py
@dac73
dac73 / amd_gpu.txt
Created October 30, 2018 18:50
AMD gpu info
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%
%%%%% Information
%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- AMD Graphics Cards
- Ubuntu 16.04
@dac73
dac73 / various-scripts.md
Created November 16, 2018 08:49
Laptop shenenigans

UDEV rule

/etc/udev/rules.d/90-xhc_sleep.rules
# disable wake from S3 on XHC1
SUBSYSTEM=="pci", KERNEL=="0000:00:14.0", ATTR{power/wakeup}="disabled"

/etc/systemd/system/mbpfan.service

[Unit]
Description=A fan manager daemon for MacBook Pro
@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

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 / 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",
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 / 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 .
@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');