Skip to content

Instantly share code, notes, and snippets.

@Kartones
Kartones / postgres-cheatsheet.md
Last active May 24, 2024 09:21
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)
@wdullaer
wdullaer / install.sh
Last active April 2, 2024 20:33
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@voxxit
voxxit / digitalocean-dyndns
Last active July 14, 2019 12:45
Dynamic DNS script for DigitalOcean. For example: to use with OpenWRT routers, install bash (opkg install bash) then place this script in /etc/hotplug.d/iface/
#!/usr/bin/env bash
set -x
# Domain you wish to update
DOMAIN="example.com"
# Get the v4/v6 addresses from icanhazip.com [pretty reliable!]
IPV4_ADDR=`wget -4 -q -O - icanhazip.com`
IPV6_ADDR=`wget -6 -q -O - icanhazip.com`
@Temikus
Temikus / update_do.sh
Last active March 13, 2023 10:21
OpenWRT DDNS using DigitalOcean API
# Script for sending user defined updates using DO API
# 2015 Artem Yakimenko <code at temik dot me>
#
# activated inside /etc/config/ddns by setting
#
# option update_script '/usr/lib/ddns/update_do.sh'
#
# the script is parsed (not executed) inside send_update() function
# of /usr/lib/ddns/dynamic_dns_functions.sh
# so you can use all available functions and global variables inside this script
@kaito834
kaito834 / urllib-request-Request.py
Last active July 19, 2023 23:37
Python 3: urllib.request and json sample
#!/usr/bin/env python
#
# tested by Python 3.4.3 on Windows 8.1
# Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
# If you need to access web site/service via proxy, set http_proxy or https_proxy.
# https://docs.python.org/3/library/urllib.request.html#urllib.request.ProxyHandler
# set http_proxy=http://127.0.0.1:8888/
# set https_proxy=https://127.0.0.1:8888/
@DraTeots
DraTeots / ComPort over Network.md
Last active May 9, 2024 13:07
ComPort over Network

Identifying Arbitrage Opportunities with Graphs


Introduction

Explaining Miles's Magic

Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.

But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.

For starters, here is the sort of thing that SI-2712 affects:

def foo[F[_], A](fa: F[A]): String = fa.toString
user=root
# disable dns server
port=0
# enable tftp server
enable-tftp
@paragonie-scott
paragonie-scott / SVG Fails.md
Last active May 8, 2020 03:49
image/svg+xml considered harmful: an open letter to member-svg-media-type@w3.org

Update

Filed an issue to address this particular concern.

Thanks joepie91 for finding the folks responsible and getting the conversation started.


Currently, SVG is a security foot-cannon that allows attackers to upload a Stored XSS payload when a user views the image directly. Example.