Skip to content

Instantly share code, notes, and snippets.

View ahmetozer's full-sized avatar
🖐️
Hi , thank you for visiting.

Ahmet ÖZER ahmetozer

🖐️
Hi , thank you for visiting.
View GitHub Profile
@ahmetozer
ahmetozer / feboot
Created August 31, 2024 15:39
Instant reboot raspberry pi and other linux systems
#!/usr/bin/env sh
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
@ahmetozer
ahmetozer / turknet-29-jul-2024-aws-eu-north-1-route.txt
Created July 29, 2024 10:05
AS12735 52.46.192.0/20 routing issue
1 172.17.1.76 (172.17.1.76) [*] 4.021 ms 4.105 ms 4.061 ms
2 173.5.154.212.dsl.dynamic.turk.net (212.154.5.173) [AS12735] 4.217 ms 4.706 ms 4.673 ms
3 174.5.154.212.dsl.dynamic.turk.net (212.154.5.174) [AS12735] 4.633 ms 4.615 ms 4.571 ms
4 177.5.154.212.dsl.dynamic.turk.net (212.154.5.177) [AS12735] 4.703 ms 4.653 ms 5.078 ms
5 165.217.70.95.reverse.turk.net (95.70.217.165) [AS12735] 28.040 ms 27.999 ms *
6 202.122.223.31.srv.turk.net (31.223.122.202) [AS12735] 27.265 ms 26.221 ms 26.281 ms
7 peer-as12735.pr01.ist1.tfbnw.net (157.240.83.185) [AS32934] 25.554 ms 25.927 ms esks-mrkz-tto-Gi0-0-1-298.turk.net (212.154.122.242) [AS12735] 27.067 ms
8 229.213.70.95.static.turk.net (95.70.213.229) [AS12735] 29.747 ms 31.779 ms 29.911 ms
9 * * *
10 * * *
@ahmetozer
ahmetozer / Readme.md
Created May 27, 2024 21:44
Raspberry PI 5 Wifi connection WPA supplicant example

Raspberry PI 5 wifi not connected with wpa_supplicant

My previous psk files are work on Raspberry pi 4, raspberry zero but at Raspberry pi 5, it is not work. For my preference, I do not use networ-manager instead I use ifupdown for managing network interfaces. While using, I face an error and after couple of configuration changes, i notice that it is realted to key_mgmt property.

WPA_SUPPLICANT error

To fix connection error, place key_mgmt=WPA-PSK-SHA256 inside your configuration

@ahmetozer
ahmetozer / dnsmasq-dhcp-fallback.sh
Created May 18, 2024 16:09
dnsmasq dhcp fallback
#!/usr/bin/env bash
ON_BACKUP=0
while true; do
if netcat -zuvn 10.0.1.2 67 > /dev/null 2>&1 ; then
if [[ $ON_BACKUP != false ]]; then
echo "Switching to primary"
ON_BACKUP=false
service dnsmasq stop > /dev/null 2>&1
fi
@ahmetozer
ahmetozer / lastip.go
Created May 6, 2024 21:45
Get last IP address of network at golang
package main
import (
"log"
"net"
)
func main() {
// convert string to IPNet struct
ip1, net1, _ := net.ParseCIDR("fd34:0135:0123::2/120")
@ahmetozer
ahmetozer / mirror-wordpress-with-httrack.sh
Created November 30, 2023 14:06
convert or backup your wordpress website with httrack
#!/bin/bash
httrack https://www.yourwebsite.com -i -O "/Users/ahmet.ozer/websites/yourwebsite" \
"*yourwebsite.com*" "-*wp-json*" "-*replytocom*" "-*p=*" "-*/feed*" \
--connection-per-second=50 --sockets=80 --keep-alive --display --verbose \
--advanced-progressinfo --disable-security-limits -s0 -o0 \
-F 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' \
--max-rate=0 --cache 1 --do-not-recatch --purge-old 0
@ahmetozer
ahmetozer / aws-cloud-trail-2-iam-actions.py
Created November 22, 2023 22:20
AWS Cloud Trail Events to IAM actions
import json
f = open('event.json')
data = json.load(f)
actions = {}
for i in data['Records']:
service=i["eventSource"].split(".")[0]
@ahmetozer
ahmetozer / openvpn-cert-generate.go
Created April 30, 2023 11:11
openvpn certificate creation with golang
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"log"
"math/big"
@ahmetozer
ahmetozer / time-update.sh
Created March 27, 2022 14:38
Update date and time with curl
#!/bin/sh
function updateDate {
date -s"@$(curl ahmetozer.org/cdn-cgi/tracert -s | grep ts= | cut -d"=" -f2 | cut -d"." -f1)"
if [ "$?" == "0" ]
then
updated="true"
fi
}
if [ "$1" == "service" ] || [ "true" == "$service" ]
@ahmetozer
ahmetozer / disable-ttyS0_service.sh
Created June 17, 2021 17:04
Timed out waiting for device dev-ttyS0.device.
#/bin/bash
rm /lib/systemd/system/serial-getty\@.service