Skip to content

Instantly share code, notes, and snippets.

@grantpullen
grantpullen / css-selectors.md
Created April 26, 2021 07:25 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@grantpullen
grantpullen / free_email_provider_domains.txt
Created September 18, 2020 10:31 — forked from okutbay/free_email_provider_domains.txt
Most complete list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0039.cf
0039.ga
0039.ml
007addict.com
00b2bcr51qv59xst2.cf
00b2bcr51qv59xst2.ga
00b2bcr51qv59xst2.ml
020.co.uk
02466.cf
02466.ga

Display live HTTP traffic to console on a specified port for all interfaces

tcpdump -A -i any 'port 1333 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'

The example above captures all TCP traffic at port 133 and filter out the TCP session setup (SYN / FIN / ACK)

  • -A Print each packet (minus its link level header) in ASCII. Handy for capturing web pages.
  • -i any Include all interfaces
  • port 1333 Only look at TCP traffic to/from port 1333
  • (((ip[2:2] - ((ip[0]&amp;0xf)&lt;&lt;2)) - ((tcp[12]&amp;0xf0)&gt;&gt;2)) != 0) filter out the TCP session setup (SYN / FIN / ACK)
@grantpullen
grantpullen / linux_build.bat
Created December 20, 2019 08:33
Save git build info in Golang linux exec built within Windows
set GOARCH=amd64
set GOOS=linux
set NOW=%date% %time%
rem save the results from 'git describe --tags --dirty --always' to variable 'GINFO'
for /f %%i in ('git describe --tags --dirty --always') do set GINFO=%%i
rem set var GitInfo & var BuildDate in the go code
go build -ldflags "-X 'main.GitInfo=%GINFO%' -X 'main.BuildDate=%NOW%'" -o ./bin/gw
@grantpullen
grantpullen / SMTP_go.md
Created December 5, 2019 06:05
SMTP golang e-email troubleshooting

SMTP Ports and Troubleshooting in Go

SMTP Port Overview

  • Port 25: SMTP port 25 (RFC 821) is used for SMTP relay, where email is relayed email from email server to email server. This port is not supported by most modern email clients.

  • Port 465: Internet Assigned Numbers Authority (IANA), registered port 465 for SMTPS using SSL. The port was revoked a year later, and is not used by most modern mail servers since it's not RFC compliant.

@grantpullen
grantpullen / go_sql.md
Last active November 20, 2019 07:04
Go ANY and IN clause in PostgreSQL

Replace the IN with ANY

v := []string{"1", "2", "3", "4"}
id := 1
q := "UPDATE users SET deleted = true WHERE id = $1 and org_id = ANY($2::bigint[])"
in := "{" + strings.Join(v, ",") + "}"

res, err := Db.Exec(q, id, param)
@grantpullen
grantpullen / Extract Audio.md
Created November 18, 2019 06:31
Lossless extraction of audio from mp4/mkv

Extract .aac Audio from multiple mp4 or mkv

  • DL avconv from https://libav.org/download/
  • extract e.g. assuming Windows in the folder c:\tools\avconv
  • execute commands in linux shell e.g. gitbash
 for i in *.mp4; do /c/tools/avconv/bin/avconv -i "$i" -acodec copy "${i/.mp4/.aac}"; done
@grantpullen
grantpullen / modal.scss
Created September 25, 2019 05:00
Style modal-content of NgbModal / @ng-bootstrap/ng-bootstrap modal (background, border etc)
/* not it using @nebular, this must reside outside of @include nb-install-component() {..} */
::ng-deep .modal-content {
/* change border */
border: none;
/* change background */
background-color: red !important;
}
@grantpullen
grantpullen / KannelDLR.md
Last active September 3, 2023 20:29
Kannel DLR information and how it maps to SMPP return values.

SMSPP Delviery Reports and Kannel

This info page relates to the DLR values which are returned by kannel when requesting DLR. Some SMPP related information is also listed for reference.

dlr-mask

This [send-sms][1] parameter is used to request for delivery reports with the state of the sent message. This requires the [dlr-url][1] on sendsms-user group or use the dlr-url CGI variable to be set. The value is a bit mask composed of:

Value Description
@grantpullen
grantpullen / Kannel with Postgresql DLR storage.md
Created June 24, 2019 12:15
Kannel with Postgresql DLR storage

Kannel with Postgresql DLR storage

Create the dlr table in PostgreSQL

  • Must add WITH OIDS to the CREATE statment since kannel expects old PostgreSQL behaviour.
  • Optionally add extra column created_at to keep track of old DLR. DLR entries are automatically removed by kannel once the final dlr is received from the SMSC. In cases where this message is not received, the DLR will not be removed. A cron job can be setup to remove old DLR by comparing the current time to created_at.
CREATE TABLE dlr (
    smsc        VARCHAR(48),
    ts          VARCHAR(48),
    destination VARCHAR(48),