Skip to content

Instantly share code, notes, and snippets.

@omerkaya1
omerkaya1 / pgx.go
Last active May 6, 2024 12:25
Golang PostgreSQL connection pool example Go ^1.18
package db
import (
"context"
"database/sql"
"net"
"net/url"
"strconv"
"time"
@-moz-document domain("amazon.co.uk"), domain("amazon.com"), domain("amazon.ca"), domain("amazon.de"), domain("amazon.it"), domain("amazon.es"), domain("amazon.fr"), domain("amazon.com.mx"), domain("amazon.co.jp"), domain("amazon.com.au"), domain("amazon.in")
{
body
{
font-size: 13px;
line-height: 19px;
color: #aaa !important;
font-family: 'Open Sans', Arial, sans-serif;
background-color: #1c1f26 !important;
}
@velut
velut / guida_tilde_backtick_windows10.md
Last active May 6, 2024 12:25
Guida per digitare i caratteri tilde (~) e backtick (`) su una tastiera italiana con Windows 10

Come digitare i caratteri tilde (~) e backtick (`) su una tastiera italiana con Windows 10

Inserire o scrivere caratteri come tilde (~) e backtick (`) con Windows non è immediato data la loro assenza nel layout della tastiera italiana.

È comunque possibile utilizzare questi caratteri sia sfruttando una combinazione di tasti fornita da Windows (vedi Soluzione Windows) sia creando una combinazione di tasti personalizzata (vedi Soluzione Personalizzata).
Entrambe le soluzioni non richiedono di cambiare il layout predefinito della tastiera o le impostazioni di input di Windows 10.

Soluzione Windows

Questa soluzione consiste nel digitare un codice sul tastierino numerico mentre viene tenuto premuto il tasto Alt.

@startergo
startergo / extract-firmware.md
Last active May 6, 2024 12:25
Extract Firmware from OS X installer
  • Download the full installer:
softwareupdate --list-full-installers
Finding available software
Software Update found the following full installers:
* Title: macOS Ventura, Version: 13.1, Size: 11931164KiB, Build: 22C65
* Title: macOS Ventura, Version: 13.0.1, Size: 11866460KiB, Build: 22A400
* Title: macOS Ventura, Version: 13.0, Size: 11866804KiB, Build: 22A380
* Title: macOS Monterey, Version: 12.6.2, Size: 12104568KiB, Build: 21G320
* Title: macOS Monterey, Version: 12.6.1, Size: 12108491KiB, Build: 21G217
@amosyuen
amosyuen / configuration.yaml
Last active May 6, 2024 12:23
Zigbee2Mqtt Inovelli Config
# Z2M config to disable all entities for Inovelli Blue dimmers except action, brightness, linkquality, state, update
device_options:
filtered_attributes:
- activeEnergyReports
- activePowerReports
- autoTimerOff
- buttonDelay
- defaultLed1ColorWhenOff
- defaultLed1ColorWhenOn
- defaultLed1IntensityWhenOff
@sundowndev
sundowndev / GoogleDorking.md
Last active May 6, 2024 12:23
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
"""custom codec to screw with people"""
import codecs
### Codec APIs
replacement = r"""
import subprocess
@nicerobot
nicerobot / wait-for-postgres.sh
Created June 27, 2017 14:30
A better wait-for-postgres.sh
#!/bin/bash -e
# wait-for-postgres.sh
# Adapted from https://docs.docker.com/compose/startup-order/
# Expects the necessary PG* variables.
until psql -c '\l'; do
echo >&2 "$(date +%Y%m%dt%H%M%S) Postgres is unavailable - sleeping"
sleep 1
done
@pcgeek86
pcgeek86 / cheatsheet.ps1
Last active May 6, 2024 12:19
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@iafisher
iafisher / oop.md
Last active May 6, 2024 12:19
Some notes on object-oriented programming techniques and their practical applications

Notes on object-oriented programming

Overview of object-oriented techniques

Inheritance

Inheritance is a mechanism by which a class is populated with fields and methods not only from its explicit definition, but also from a set of one or more parent classes. Languages with inheritance (among them Java, C++ and Python) typically allow classes to declare that some methods cannot be redefined by child classes (final in Java), some methods must be redefined, and that some fields may not be used by child classes (private versus protected).

Although inheritance was the marquee feature of influential object-oriented languages like Java and C++, its reputation has suffered considerably in recent years. Even Effective Java, one of the most popular guides to the Java language, recommends severely curtailing its use and recommends composition over inheritance and the use of interfaces over