Skip to content

Instantly share code, notes, and snippets.

View a7md0's full-sized avatar

Ahmed Naser a7md0

View GitHub Profile
@a7md0
a7md0 / rr_line_generator.py
Last active May 9, 2025 13:18
Generate dns-rr line that can be used in dnsmasq for SVCB and possibly HTTPS records for DNS over HTTPS (DoH), DNS over QUIC (DoQ) and possibly DNS over TLS (DoT)
#!/usr/bin/python3
import json
import binascii
# pip3 install dnspython
import dns.name
import dns.rdataclass
import dns.rdatatype
import dns.rdata
@a7md0
a7md0 / bahrain-public-cidr.csv
Created April 29, 2025 17:36
Bahrain Public IPv4/IPv6 CIDRs
AS Handle ASN Name Organization ID Organization Name Country CIDR Stack
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 2001:1a40::/32 IPv6
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 77.69.128.0/18 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 77.69.192.0/19 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 77.69.224.0/19 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 82.194.32.0/19 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 84.255.128.0/18 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 88.201.0.0/19 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 88.201.32.0/19 IPv4
AS5416 - ORG-BA6-RIPE Beyon B.s.c. Bahrain 88.201.64.0/19 IPv4
@a7md0
a7md0 / .0readme
Last active May 9, 2025 13:34
[RaspberryPi] Create personal cloud using ownCloud (Dec 28, 2018) Bahrain Polytechnic
Note that all commands and configuration files are pre-prepared by myself, collected from several sources which I will refer to them at the end of the description. Done on RPi3 on Dec 28, 2018 during studies in Bahrain Polytechnic
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
The idea itself: https://www.avoiderrors.com/raspberry-pi-3-into-a-personal-cloud-storage-2017/
Tutorial for installation: https://www.avoiderrors.com/owncloud-10-raspberry-pi-3-raspbian-stretch/
(Offical download page of the ownCloud software: https://owncloud.org/download/
Official installation documentation: https://doc.owncloud.org/server/latest/admin_manual/installation/
System requirements: https://doc.owncloud.org/server/latest/admin_manual/installation/system_requirements.html
@a7md0
a7md0 / callback.html
Created September 10, 2022 21:28
OAuth JS button implementation (popup)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Callback</title>
<script>
if (window.opener != null) {
const message = {
@a7md0
a7md0 / example.dart
Created May 2, 2022 19:17
Custom HTTP exceptions with DioError factory constructor
final httpClient = Dio()..options.baseUrl = 'https://example.com';
try {
var response = await httpClient.post(
'/auth/signup',
data: values,
);
if (response.data == null) {
throw const EmptyResponseException(); // Manually throw the exception
@a7md0
a7md0 / connectivity_cubit.dart
Created January 19, 2022 16:40
Flutter connectivity cubit
import 'package:bloc/bloc.dart';
import 'package:connectivity/connectivity.dart';
part 'connectivity_state.dart';
class ConnectivityCubit extends Cubit<ConnectivityState> {
ConnectivityCubit() : super(const ConnectivityInitial()) {
final connectivity = Connectivity();
connectivity.checkConnectivity().then(_onConnectivityChanged);
connectivity.onConnectivityChanged.listen(_onConnectivityChanged);
@a7md0
a7md0 / BitLockerDrive.bat
Created January 19, 2022 16:35
Lock/unlock BitLocker encrypted drive script
@set DRIVE=%1
@manage-bde -status %DRIVE% | find "Lock Status:" | find "Locked" > nul2
@if "%ERRORLEVEL%"=="0" (
@manage-bde -unlock -pw %DRIVE%
) else (
@manage-bde -lock -ForceDismount %DRIVE%
)
@manage-bde -status %DRIVE% | find "Lock Status:" | find "Unlocked" > nul2
@a7md0
a7md0 / TableSchema.cs
Last active April 30, 2021 17:50
Parse SqlDataReader.GetSchemaTable into useable object
using System;
using System.Data;
using System.Collections.Generic;
public class TableSchema {
private Dictionary<string, TableSchemaColumn> columns;
public TableSchema(DataTable dataTable) {
this.columns = new Dictionary<string, TableSchemaColumn>();