Skip to content

Instantly share code, notes, and snippets.

View apie's full-sized avatar

Denick apie

View GitHub Profile
@hyperupcall
hyperupcall / settings.jsonc
Last active June 26, 2024 18:59
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
@sdondley
sdondley / tmux split-window subcommand.md
Last active June 10, 2024 00:21
Super Guide to the split-window tmux Subcommand (and Beyond)

Super Guide to the split-window tmux Subcommand (and Beyond)

Guide overview

tmux, like other great software, is deceptive. On the one hand, it's fairly easy to get set up and start using right away. On the other hand, it's difficult to take advantage of tmux's adanced features without spending some quality alone time with the manual. But the problem with manuals is that they aren't geared toward beginners. They are geared toward helping seasoned developers and computer enthusiasts quickly obtain the

@rivo
rivo / postgres.go
Last active August 6, 2023 22:39
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@andrew-azarov
andrew-azarov / mailman.py
Last active May 1, 2016 21:29
Short and simple email function for python, easy to plug in into any scripts and run right away.
#!/usr/bin/env python
# coding=utf8
"""
Copyright (c) 2013 Azar-A Ltd., Azarov Andrew
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@olih
olih / jq-cheetsheet.md
Last active July 2, 2024 12:10
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@jtangelder
jtangelder / teletekst.py
Last active June 8, 2021 11:42
CLI teletekst.
import urllib.request
import urllib.error
import json
import re
import cmd
import html
def getTeletekstPage(page):
url = 'http://teletekst-data.nos.nl/json/%s' % (page)
res = urllib.request.urlopen(url)
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 2, 2024 22:38
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@Benoss
Benoss / config_local.py
Created March 17, 2014 01:09
Django add Debug Toolbar for non HTML response ex: Json rest response
DEBUG=True
SOUTH_TESTS_MIGRATE = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'geo', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': 'postgres', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@thatalextaylor
thatalextaylor / 1-python-pretty-time-delta.py
Last active November 5, 2023 22:48
Pretty print a time delta in Python in days, hours, minutes and seconds
def pretty_time_delta(seconds):
sign_string = '-' if seconds < 0 else ''
seconds = abs(int(seconds))
days, seconds = divmod(seconds, 86400)
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmod(seconds, 60)
if days > 0:
return '%s%dd%dh%dm%ds' % (sign_string, days, hours, minutes, seconds)
elif hours > 0:
return '%s%dh%dm%ds' % (sign_string, hours, minutes, seconds)