Skip to content

Instantly share code, notes, and snippets.

View marcostolosa's full-sized avatar
👽
Memento Mori. Try Harder.

Marcos Tolosa marcostolosa

👽
Memento Mori. Try Harder.
View GitHub Profile
@marcostolosa
marcostolosa / read-access.sql
Created April 16, 2019 12:51 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@marcostolosa
marcostolosa / nginx.conf
Last active April 16, 2019 13:13 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
worker_processes 2;
events {
worker_connections 1024;
}
upstream app {
server 127.0.0.1:5000 fail_timeout=0;
}
@marcostolosa
marcostolosa / wp.sh
Created March 13, 2019 16:16 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@marcostolosa
marcostolosa / k8-install.sh
Created February 8, 2019 14:07
Minikube with KVM - Ubuntu 18.04
#!/bin/bash
# Config: ~/.minikube/machines/minikube/config.json
# kubectl config view
### Installing QEMU/KVM
apt install -y qemu-kvm libvirt-bin virt-top libguestfs-tools virtinst bridge-utils
modprobe vhost_net
lsmod | grep vhost
echo "vhost_net" | tee -a /etc/modules
@marcostolosa
marcostolosa / .conkyrc
Created January 21, 2019 17:10
Manjaro Conky Config
background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 1.0
total_run_times 0
out_to_console no
own_window yes
own_window_argb_visual true
own_window_transparent yes
@marcostolosa
marcostolosa / exif-read-coordenates.md
Last active January 14, 2019 19:11
How read coordinates
North or South Latitude East or West Longitude
North latitude West longitude
46, 11, 42,152 94, 5, 12,890

========================================

Google search: 46°11'42.152"N 94°5'12.890"W

@marcostolosa
marcostolosa / Bin2ascii.py
Created January 9, 2019 19:44
Transform binary to text/ascii
import binascii, sys
n = int(sys.argv[1], 2)
f = binascii.unhexlify('%x' % n)
print f
@marcostolosa
marcostolosa / git-update-fork.sh
Created January 7, 2019 16:01
How to upgrade a fork with changes from the original?
# How to upgrade a fork with changes from the original?
# Specify a new remote upstream repository that will be synced with the fork.
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# Verify the new upstream repository you've specified for your fork.
# git remote -v
# origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
@marcostolosa
marcostolosa / .htaccess
Created December 15, 2018 08:40
PageSpeed Module - mod_pagespeed .htaccess config
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@marcostolosa
marcostolosa / socat.md
Last active March 4, 2025 02:36
SOCAT Useful commands

To link serial port ttyS0 to another serial port: socat /dev/ttyS0,raw,echo=0,crnl /dev/ttyS1,raw,echo=0,crnl

To get time from time server: socat TCP:time.nist.gov:13 -

To forward local http port to remote http port: socat TCP-LISTEN:80,fork TCP:www.domain.org:80