Skip to content

Instantly share code, notes, and snippets.

View edpyt's full-sized avatar
🦍
todo!();

edpyt

🦍
todo!();
View GitHub Profile
@hfossli
hfossli / standard.sh
Last active March 4, 2025 12:58
Standard bash script format
#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
@Checksum
Checksum / postgresql-event-trigger.sql
Created August 1, 2018 07:20
Automatically create column on new tables using PostgreSQL event triggers
-- Function to automatically create a user_id column for new tables with name starting with user_
create or replace function create_user_id_column()
returns event_trigger
language plpgsql volatile as
$$
declare
obj record;
identity text[];
begin
for obj in select * from pg_event_trigger_ddl_commands()
@abitrolly
abitrolly / postdata.py
Last active July 12, 2024 03:11
POST JSON with Python3 urllib
# Public domain
from urllib import request
def post_data(url, data, headers={'Content-Type':'application/json'}):
"""
POST data string to `url`, return page and headers
"""
# if data is not in bytes, convert to it to utf-8 bytes
bindata = data if type(data) == bytes else data.encode('utf-8')
@RebelLion420
RebelLion420 / TermuxArchSetup2024.md
Last active March 15, 2025 21:43
How to set up Arch Linux in Termux on Android

NOTICE: This will take up about 3 GB of space on your device, before syncing any repos or projects.

Install Termux from the Play Store and launch it

Once it finishes unpacking:

pkg update

pkg upgrade -y

CockroachDB and Docker Compose

This is the first in a series of tutorials on CockroachDB and Docker Compose

  • Information on CockroachDB can be found here.
  • Information on Docker Compose can be found here
  1. Install Docker Desktop

Because we already have an official CockroachDB docker image, we will use that in our docker-compose.yml file. We recommend you use one of the current tags instead of latest.

@rafaelhenrique
rafaelhenrique / test_sqlalchemy+asyncpg.py
Created April 17, 2021 02:06
Sqlalchemy + Asyncpg + Pytest = <3
# reference: https://github.com/sqlalchemy/sqlalchemy/issues/5626
import pytest
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
Base = orm.declarative_base()
@Himura2la
Himura2la / Grafana Alert Template.md
Last active December 24, 2024 14:41
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{ define "alert_list" }}{{ range . }}{{ .Labels.alertname }}
    {{ range .Annotations.SortedPairs }}<strong>{{ .Name }}</strong>: {{ .Value }}
    {{ end }}| {{ if gt (len .GeneratorURL) 0 }}<a href="{{ .GeneratorURL }}">source</a> | {{ end }}{{ if gt (len .SilenceURL) 0 }}<a href="{{ .SilenceURL }}">silence</a> | {{ end }}{{ if gt (len .DashboardURL) 0 }}<a href="{{ .DashboardURL }}">dashboard</a> | {{ end }}{{ if gt (len .PanelURL) 0 }}<a href="{{ .PanelURL }}">panel</a> |{{ end }}
    —
    {{ end }}{{ end }}
    {{ define "telegram.message" }}
    

{{ if gt (len .Alerts.Firing) 0 }}FIRING!!!

@amantinband
amantinband / Aggregates.Bill.md
Last active January 2, 2025 19:24
Buber Dinner Domain Aggregates

Domain Aggregates

Bill

class Bill
{
    // TODO: Add methods
}
@fabian-thomas
fabian-thomas / orgzly-sync.sh
Last active March 9, 2025 11:35
Orgzly auto syncronisation for sync tools like syncthing. See orgzly/orgzly-android#8.
#!/data/data/com.termux/files/usr/bin/bash
# https://github.com/orgzly/orgzly-android/issues/8
orgzly_sync() {
# if you are using orgzly-revived use the following instead:
# am broadcast -n com.orgzlyrevived/com.orgzly.android.ActionReceiver -a com.orgzly.intent.action.SYNC_START
am broadcast -n com.orgzly/com.orgzly.android.ActionReceiver -a com.orgzly.intent.action.SYNC_START
}
@gelldur
gelldur / Grafana Alert Template.md
Last active April 22, 2025 10:14 — forked from Himura2la/Grafana Alert Template.md
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{- /* Telegram message to use: {{ template "telegram.message2" . }} */ -}}
    {{ define "__alerts_list" -}}
    {{ range . }}
    {{if ne (index .Labels "alertname") "" -}}
    {{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }}
        {{- if ne (index .Labels "severity") "" -}}
            <u><b>P{{ index .Labels "severity" }}</b></u> {{ end -}}