Skip to content

Instantly share code, notes, and snippets.

View chocobn69's full-sized avatar
🏸
Working

chocobn69 chocobn69

🏸
Working
View GitHub Profile
@chocobn69
chocobn69 / gmail_api.md
Last active October 18, 2022 10:46 — forked from olgakogan/gmail_api.md
Manually get OAuth credentials to access your gmail account via API

Basic setup

  1. Access the developer console https://console.developers.google.com
  2. Create a new project
  3. In APIs and Oauth section:
    a. In APIs section - enable gmail api
    b. In Credentials section -
    1. Click Create new client ID
    2. Fill email and project name
    3. Save
#!/bin/bash
set -eo pipefail
host="$(hostname --ip-address || echo '127.0.0.1')"
user="${POSTGRES_USER:-postgres}"
db="${POSTGRES_DB:-$POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD:-}"
args=(
# force postgres to not use the local unix socket (test "external" connectibility)
create table town(id, label);
create table road(id, start_town_id, end_town_id);
create table travel(id, road_id);
-- I want all town, both start and end
select
unnest(array[start_town_id, end_town_id])
from travel
@chocobn69
chocobn69 / neomuttrc
Created September 25, 2018 08:57 — forked from VladimirPal/neomuttrc
Minimal neomutt config for gmail imap
set imap_user="[email protected]"
set imap_pass=`/usr/bin/security find-generic-password -w -a '[email protected]' -s 'Gmail'`
set folder=imaps://imap.gmail.com/
set spoolfile=+INBOX
set record="+[Gmail]/Sent Mail"
set postponed="+[Gmail]/Drafts"
# https://www.neomutt.org/guide/reference search sleep_time for additional info
set sleep_time=0 # be faster
from django.contrib.postgres.search import SearchQuery, SearchVector
combined_search_queries = SearchQuery('test')
for _ in range(200):
combined_search_queries |= SearchQuery('test')
print(combined_search_queries)

new pg server

compilation

./configure \
--with-systemd \
--with-libxml \
--with-pam \
--with-system-tzdata=/usr/share/zoneinfo \
--with-uuid=e2fs \
--with-openssl \
#!/usr/bin/env sh
for service in $(docker service ls|awk -v N=2 '{print $N}')
do
echo "Rebalance $service"
docker service update --force $service
done
{Visual}["x]x or *v_x* *v_d* *v_<Del>*
{Visual}["x]d or
{Visual}["x]<Del> Delete the highlighted text [into register x] (for
{Visual} see |Visual-mode|).
@chocobn69
chocobn69 / pg_replication_logical_tests.md
Last active October 8, 2018 12:07
pg logical replication tests
SELECT
COALESCE(blockingl.relation::regclass::text,blockingl.locktype) as locked_item,
now() - blockeda.query_start AS waiting_duration,
blockeda.pid AS blocked_pid,
blockeda.query as blocked_query, blockedl.mode as blocked_mode,
blockinga.pid AS blocking_pid, blockinga.query as blocking_query,
blockingl.mode as blocking_mode
FROM pg_catalog.pg_locks blockedl
JOIN pg_stat_activity blockeda ON blockedl.pid = blockeda.pid
JOIN pg_catalog.pg_locks blockingl ON(