Skip to content

Instantly share code, notes, and snippets.

@ohforest
ohforest / nginx.conf
Created October 28, 2022 11:49 — forked from arehmandev/nginx.conf
Nginx transparent proxy
events {
worker_connections 1024;
}
http {
# google's DNS server
resolver 8.8.8.8;
resolver_timeout 5s;
server {
# proxy server port
@ohforest
ohforest / Install.txt
Created October 27, 2022 03:27 — forked from soderlind/Install.txt
macOS DoH! (DNS over HTTPS) using cloudflared
1) Install cloudflared using homebrew:
brew install cloudflare/cloudflare/cloudflared
2) Create /usr/local/etc/cloudflared/config.yaml, with the following content
proxy-dns: true
proxy-dns-upstream:
- https://1.1.1.1/dns-query
- https://1.0.0.1/dns-query
@ohforest
ohforest / python_email_parse.py
Created September 22, 2022 10:40 — forked from strayge/python_email_parse.py
email parse pop3 python
import poplib
import email
from base64 import b64decode
pop3_server = 'pop.gmail.com'
pop3_port = '995'
username = '[email protected]'
password = 'XXXXXXXXXXXXXX'
M = poplib.POP3_SSL(pop3_server, pop3_port)
@ohforest
ohforest / 00.install-android-sdk.sh
Created September 13, 2022 06:54 — forked from nhtua/00.install-android-sdk.sh
Run a Headless Android Device on Ubuntu server (no GUI)
#!/bin/bash -i
#using shebang with -i to enable interactive mode (auto load .bashrc)
set -e #stop immediately if any error happens
# Install Open SDK
apt update
apt install openjdk-8-jdk -y
update-java-alternatives --set java-1.8.0-openjdk-amd64
java -version
@ohforest
ohforest / ip_blacklist.lua
Created September 6, 2022 07:49 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@ohforest
ohforest / go_time_parsing.md
Created August 25, 2022 13:49 — forked from unstppbl/go_time_parsing.md
Parsing custom time layout in Golang

There are some key values that the time.Parse is looking for.

By changing:

test, err := time.Parse("10/15/1983", "10/15/1983")

to

@ohforest
ohforest / _struct_to_map.go
Created August 19, 2022 10:45 — forked from bxcodec/_struct_to_map.go
Golang Struct To Map Example By JSON tag
/*
This function will help you to convert your object from struct to map[string]interface{} based on your JSON tag in your structs.
Example how to use posted in sample_test.go file.
*/
func structToMap(item interface{}) map[string]interface{} {
res := map[string]interface{}{}
if item == nil {
return res
}
@ohforest
ohforest / encrypt_file_pkcs5_pkcs7.go
Created August 11, 2022 10:17 — forked from huyinghuan/encrypt_file_pkcs5_pkcs7.go
golang encrypt with pkcs5 and pkcs7
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"io"
"io/ioutil"
@ohforest
ohforest / oracle_sql_text_spid.sql
Created July 15, 2022 10:54 — forked from katjunior/oracle_sql_text_spid.sql
Oracle - Select Sql Text from System Process ID
select s.sql_text,s.sql_fulltext from v$sql s
where sql_id in (SELECT A.SQL_ID FROM V$SESSION A,V$PROCESS B
WHERE A.PADDR=B.ADDR AND B.SPID='6495')
@ohforest
ohforest / synapticshotkey.ahk
Created March 30, 2022 14:05 — forked from ygurin/synapticshotkey.ahk
Simple AutoHotkey script disables and enables touchpad on Windows 10. Synaptics touchpad driver must be installed. This is targeted at older machines where the driver is installed, but Function key for disabling the touchpad doesn’t work.
;Disable and Enable Synaptics touchpad using Keyboard Shortcut on Windows 10
;CTRL+F9 to enable the Synaptics Touchpad
^F9::
Run C:\Windows\System32\control.exe main.cpl ;Open Mouse Properties
Sleep 1000 ;Wait one second
if WinExist("Mouse Properties") {
WinActivate ;Make Mouse Properties the active Window
Send, ^+{TAB} ;Go to last tab
Send, !E ;Alt+E to enable touchpad