Skip to content

Instantly share code, notes, and snippets.

@navmed
navmed / Code.gs
Created November 21, 2023 21:06 — forked from benbjurstrom/Code.gs
PurgeOldEmails
/*
|--------------------------------------------------------------------------
| PurgeOldEmails
|--------------------------------------------------------------------------
| https://gist.github.com/benbjurstrom/00cdfdb24e39c59c124e812d5effa39a
|
*/
// Purge messages automatically after how many days?
var DELETE_AFTER_DAYS = 7
@navmed
navmed / DarkMode.vba
Last active September 9, 2022 20:09
Excel macro to switch the sheet between actual dark mode and light mode
' For this to work create a file called "BlackBackground.jpg" in the path, with a full black image. It can be 1x1 pixels, but the size doesn't matter.
Sub Dark_mode()
'
' Dark_mode Macro
'
' Keyboard Shortcut: Ctrl+d
'
ActiveSheet.SetBackgroundPicture Filename:= _
@navmed
navmed / MySQL Replication Check
Created August 19, 2021 01:42 — forked from OliverBailey/MySQL Replication Check
Just a simple Mysql Replication Health Check script I wrote. You can put this in a cron.
#!/bin/bash
### VARIABLES ### \
EMAIL=""
SERVER=$(hostname)
MYSQL_CHECK=$(mysql --login-path=mysql_login -e "SHOW VARIABLES LIKE '%version%';" || echo 1)
STATUS_LINE=$(mysql --login-path=mysql_login -e "SHOW SLAVE STATUS\G")"1"
LAST_ERRNO=$(grep "Last_Errno" <<< "$STATUS_LINE" | awk '{ print $2 }')
SECONDS_BEHIND_MASTER=$( grep "Seconds_Behind_Master" <<< "$STATUS_LINE" | awk '{ print $2 }')
IO_IS_RUNNING=$(grep "Slave_IO_Running:" <<< "$STATUS_LINE" | awk '{ print $2 }')
@navmed
navmed / StripeEvents.ts
Created August 25, 2020 23:58
Typescript enumeration for stripe events
export enum StripeEvents
{
account__updated = 'account.updated',
account__application__authorized = 'account.application.authorized',
account__application__deauthorized = 'account.application.deauthorized',
account__external_account__created = 'account.external_account.created',
account__external_account__deleted = 'account.external_account.deleted',
account__external_account__updated = 'account.external_account.updated',
application_fee__created = 'application_fee.created',
application_fee__refunded = 'application_fee.refunded',
@navmed
navmed / base58.js
Created July 29, 2020 22:01 — forked from inflammable/base58.js
Base58 (and other) Encoding and Decoding in Javascript
/*
* base58.js
* - encodes integers to and decodes from a base58 (or your own) base58 alphabet
* - based on Flickr's url shortening
*
* usage:
* base58.encode(integer);
* base58.decode(string);
*
* (c) 2012 inflammable/raromachine

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