Skip to content

Instantly share code, notes, and snippets.

View asrarak's full-sized avatar
🏠
Working from home

Asrarakhair asrarak

🏠
Working from home
View GitHub Profile
@asrarak
asrarak / pihole_dnscrypt-proxy_captive_portal_bypass.md
Created January 23, 2023 16:53 — forked from kopijahe/pihole_dnscrypt-proxy_captive_portal_bypass.md
Bypass dnscrypt-proxy for network captive portal when using pihole

English

  1. Login to your pihole using SSH
  2. Create a new configuration file in /etc/dnsmasq.d/ folder (use 00- prefix, for example 00-wifiid.conf
  3. Insert strict-order and your captive portal's DNS server in the new file, for example when using this on wifi.id networks:
strict-order  
server=/wifi.id/118.98.44.100  
server=/iwifi.id/118.98.44.100
server=/connectivitycheck.gstatic.com/118.98.44.100
@asrarak
asrarak / abuseipdb_block.py
Created May 8, 2022 13:08 — forked from Bsebring/abuseipdb_block.py
Python implementation of csf integration
#!/usr/bin/env python
import requests
import json
import sys
# Defining the api-endpoint
url = 'https://api.abuseipdb.com/api/v2/report'
ports = sys.argv[2]
inOut = sys.argv[4]
@asrarak
asrarak / cheatsheet-elasticsearch.md
Created August 25, 2021 12:46 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@asrarak
asrarak / gist:e71b3ad82d1d760d1e2bd1ae4e41da8c
Created May 6, 2020 14:07 — forked from pvalkone/gist:8942370
Create a ZFS pool on FreeBSD 10.0-RELEASE with Advanced Format (4K sector) drives
# Create 4K sector gnop(8) devices for the first disk of each of the three vdevs
$ sudo gnop create -S 4096 /dev/label/disk1 /dev/label/disk5 /dev/label/disk8
# Create the backup pool using three RAID-Z1 vdevs
$ sudo zpool create backup raidz /dev/label/disk1.nop /dev/label/disk2 /dev/label/disk3 /dev/label/disk4
$ sudo zpool add backup raidz /dev/label/disk5.nop /dev/label/disk6 /dev/label/disk7 /dev/label/disk12
$ sudo zpool add backup raidz /dev/label/disk8.nop /dev/label/disk9 /dev/label/disk10 /dev/label/disk11
$ zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
@asrarak
asrarak / LFCS_study
Created April 3, 2019 16:09 — forked from gojun077/LFCS_study
LFCS Study Outline 2015.02.28
* LFCS Domains 2015.02
Note - the domains will change somewhat in March 2015. SW RAID
with mdadm will be removed
** The Command Line
*** Editing text files on the CLI
Covers the use of the basic text editors nano and gedit as well
as the advanced editors _vi_ and _emacs_
- nano
simple CLI-based text editor
@asrarak
asrarak / server-monitor.sh
Created March 21, 2018 00:18 — forked from turntayble81/server-monitor.sh
Apache/MySQL tuning script
#!/bin/bash
freeMem=`mysql --defaults-file=/root/.my.cnf -s -e "SHOW STATUS WHERE Variable_name='Qcache_free_memory'" | awk '{print $2}'`;
totalMem=`mysql --defaults-file=/root/.my.cnf -s -e "SHOW VARIABLES WHERE Variable_name ='query_cache_size'" | awk '{print $2}'`;
usedMem=$((totalMem-freeMem));
freePct=$(echo "scale=4;($freeMem/$totalMem) * 100" | bc);
freePct=`echo $freePct | awk '{ printf "%.0f\n", $1 }'`;
usedPct=$(echo "scale=4;($usedMem/$totalMem) * 100" | bc);
@asrarak
asrarak / nginx.conf
Created October 3, 2017 00:20 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048