Skip to content

Instantly share code, notes, and snippets.

@grantpullen
grantpullen / addr.go
Created August 8, 2018 06:59 — forked from andres-erbsen/addr.go
Get public IP address in Go #golang
package main
import (
"net"
"sort"
"strconv"
"strings"
)
func rfc1918private(ip net.IP) bool {
@grantpullen
grantpullen / angular.md
Last active August 21, 2018 06:54
Angular snippets

Angular Snippets

Date pipes in two way ngModel binding within an <input/>

When doing a two way binding [(ngModel)]= to a piped value [(ngModel)]="camp.end_at | date:'yyyy-MM-dd'" you get the following error Parser Error: Cannot have a pipe in an action expression To correct, do one way binding and change the value via (ngModelChange) e.g.

@grantpullen
grantpullen / fastdelete.bat
Last active May 22, 2023 03:19
Windows 10 fast delete
@echo off
echo Delete Folder: %CD%
setlocal
:PROMPT
set /P AREYOUSURE=Are you sure (Y/[N])?
if /I "%AREYOUSURE%" NEQ "Y" goto END
echo Removing Folder: %CD%
set FOLDER=%CD%
cd /
@grantpullen
grantpullen / defend_no_more.reg
Created September 20, 2018 04:39
Disable windows defender
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection]
"DisableBehaviorMonitoring"=dword:00000001
"DisableOnAccessProtection"=dword:00000001
"DisableScanOnRealtimeEnable"=dword:00000001
@grantpullen
grantpullen / bash_history_multiple_terminal
Created October 18, 2018 11:27
Bash history with multiple terminals open saved.
# Add line below to /root/.bashrc or required acconut under /home/user/.bashrc
export HISTSIZE=50000
# Maximum number of history lines on disk
export HISTFILESIZE=50000
# After each command, append to the history file
# and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
@grantpullen
grantpullen / static_compile.md
Last active March 7, 2019 08:33
How to static compile c

Static Compile

Compile flags

Add the following -static -static-libgcc -static-libstdc++

Verify if executable is statically compiled

  1. Verify there is really no dynamic linkage ldd executable

  2. Verify there are no unresolved symbols nm executable | grep " U "

@grantpullen
grantpullen / tunnel.md
Created April 3, 2019 09:33
tunnel ssh shuttle

author: Grey-Matter

Pivoting And Port Forwarding

Forwarding and Pivoting can be a confusing topic. I still get headache's sometimes trying to keep track of what i did to get to this port, and how im gonna get a reverse shell back to that subnet and whatnot. This is just a quick writeup attempting to show the differences in the main types of forwards and pivots, as well as what works for me.

For the purpose of this tut, im gonna set a few static ip's that ill stick with til the end

LHOST = 192.168.1.1

@grantpullen
grantpullen / IntelliJ_Gnome_Key_Binding_Fix.md
Created April 17, 2019 13:35
Fix IntelliJ Navigate back/forward navigation '<Control><Alt>Left' and '<Control><Alt>Right' in Gnome

Fix IntelliJ Navigate back/forward navigation <Control><Alt>Left and <Control><Alt>Right in Gnome

The following commands must be run in the user shell.

Inspect current binding

gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-left
gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-right

Remove key binding from gnome

@grantpullen
grantpullen / wildfly.md
Created May 30, 2019 09:33
Change core-threads count in wildfly via cli

/opt/wildfly/bin/jboss-cli.sh -c

/subsystem=ee/managed-executor-service=default:write-attribute(name=core-threads,value=16)

@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),