Skip to content

Instantly share code, notes, and snippets.

View Raidus's full-sized avatar

Wilhelm R. Raidus

View GitHub Profile
@Raidus
Raidus / README.md
Created March 26, 2021 11:15
Query Tableau Extract via Postgres FDW #tableau #postgres

Good Reference Article

Setup Hyper API Server

  1. conda create --name tableau python=3.7
  2. conda activate tableau
  3. pip install tableauhyperapi
  4. /opt/anaconda3/envs/tableau/lib/python3.7/site-packages/tableauhyperapi/bin/hyper/hyperd run --init-user=tableau_internal_user --log-dir /Users/wilhelm/Downloads/ -d /Users/wilhelm/Downloads/many_cols.hyper --skip-license --no-password --listen-connection tab.tcp://0.0.0.0:7483 (NOTE: adjust PATHS for log dir and hyper extract)

Setup FDW in Postgres

@Raidus
Raidus / Spark+ipython_on_MacOS.md
Created November 10, 2020 15:46 — forked from ololobus/Spark+ipython_on_MacOS.md
Apache Spark installation + ipython/jupyter notebook integration guide for macOS

Apache Spark installation + ipython/jupyter notebook integration guide for macOS

Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

For older versions of Spark and ipython, please, see also previous version of text.

Install Java Development Kit

@Raidus
Raidus / gist:5bccebc803d0eda974bb1468431c6600
Created June 30, 2020 11:24 — forked from getify/gist:3667624
escape all double-quote chars in a string
// NOTE: only escapes a " if it's not already escaped
function escapeDoubleQuotes(str) {
return str.replace(/\\([\s\S])|(")/g,"\\$1$2"); // thanks @slevithan!
}
escapeDoubleQuotes("ab"); // ab => ab
escapeDoubleQuotes("a\"b"); // a"b => a\"b
escapeDoubleQuotes("a\\\"b"); // a\"b => a\"b
escapeDoubleQuotes("a\\\\\"b"); // a\\"b => a\\\"b
escapeDoubleQuotes("a\\\\\\\"b"); // a\\\"b => a\\\"b
@Raidus
Raidus / snippet.sql
Last active April 11, 2020 06:48
[How to find size of Database and Table in PostgreSQL] DBA Scripts #postgres
# Resource: https://www.dbrnd.com/2015/05/how-to-find-size-of-database-and-table-in-postgresql/
# Find all the table size in the current database.
SELECT
table_schema || '.' || table_name AS TableName,
pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')) AS TableSize
FROM information_schema.tables
ORDER BY
pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') DESC;

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
@Raidus
Raidus / tinyproxy_hetzner_floating_ip.md
Last active October 5, 2019 09:24
Hetzner + Tinyproxy + Floating IP
  1. Add static ip

nano /etc/network/interfaces.d/60-my-floating-ip.cfg

auto eth0:1
iface eth0:1 inet static
    address your.float.ing.ip
    netmask 32
@Raidus
Raidus / create-user.md
Last active September 26, 2019 13:58
Postgres Hacks

su - postgres psql

Create Role

CREATE ROLE Read_Only_User WITH LOGIN PASSWORD 'Test1234' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';

Add permissions

GRANT CONNECT ON DATABASE YourDatabaseName TO Read_Only_User; GRANT USAGE ON SCHEMA public TO Read_Only_User;

# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
@Raidus
Raidus / PORT_FORWARD.md
Last active March 6, 2019 15:40
Routing/forwarding ports on Ubuntu Linux

Route port 80 => 3000

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000

Make sure changes are applied

sudo iptables -t nat -L
@Raidus
Raidus / background.js
Created February 21, 2019 04:59 — forked from GuilloOme/background.js
Puppeteer (v.0.12.0) navigation blocking workaround
(function() {
'use strict';
// keep track of all the opened tab
let tabs = {};
// Get all existing tabs
chrome.tabs.query({}, function(results) {
results.forEach(function(tab) {
tabs[tab.id] = tab;