Skip to content

Instantly share code, notes, and snippets.

View Kitsunees's full-sized avatar
🦊

Kitsunees

🦊
View GitHub Profile
@Kitsunees
Kitsunees / databricks_connection_to_gcloud_sql.py
Created April 5, 2022 09:38 — forked from jhuangtw/databricks_connection_to_gcloud_sql.py
connecting from Databricks spark to Google cloud-sql via proxy
# Overview:
# Install cloud_sql_proxy binary with appropriate credentials on all driver and worker nodes.
# References:
# https://cloud.google.com/sql/docs/postgres/connect-external-app#proxy
# https://cloud.google.com/sql/docs/postgres/sql-proxy#authentication-options
# Step 1.
# Follow https://cloud.google.com/sql/docs/postgres/connect-external-app#proxy to set up:
# - enable Cloud SQL API
@Kitsunees
Kitsunees / postgres cheatsheet.md
Created January 31, 2022 12:15 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@Kitsunees
Kitsunees / read-access.sql
Created January 31, 2022 12:04 — 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;
@Kitsunees
Kitsunees / ansible_discord_webhook.py
Created August 25, 2021 08:46 — forked from swedgwood/ansible_discord_webhook.py
Ansible module for sending messages using discord webhooks.
#!/usr/bin/python
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
# !/bin/bash
######################
# DOCKER MODE RULES: #
######################
# Backup/Restore
# iptables-save > iptables-backup.txt
# cat iptables-backup.txt
# iptables-restore < iptables-backup.txt
@Kitsunees
Kitsunees / cloudflare.sh
Last active February 3, 2021 08:39 — forked from Manouchehri/cloudflare.sh
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
# Backup/Restore
# iptables-save > iptables-backup.txt
# cat iptables-backup.txt
# iptables-restore < iptables-backup.txt
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
sudo apt-get install -y \
git \
g++ \
libgtk-3-dev \
gtk-doc-tools \
gnutls-bin \
valac \
intltool \
libtool \
libpcre2-dev \
@Kitsunees
Kitsunees / docker-compose.yaml
Created January 12, 2021 10:23 — forked from darth-veitcher/docker-compose.yaml
Traefik v2.0 with Cloudflare Wildcard and OpenVPN
version: "3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
command:
# Globals
- "--log.level=DEBUG"
- "--api=true"