Skip to content

Instantly share code, notes, and snippets.

View Zorono's full-sized avatar
😌
I may be slow to respond.

John Magdy Lotfy Kamel Zorono

😌
I may be slow to respond.
View GitHub Profile
@Zorono
Zorono / Makefile
Created September 23, 2024 16:29 — forked from alwynallan/Makefile
Hardware PWM Controller for the Raspberry Pi 4 Case Fan
CC = gcc
RM = rm -f
INSTRUMENT_FOR_PROMETHEUS := false
ifeq ($(INSTRUMENT_FOR_PROMETHEUS),true)
CFLAGS = -Wall -DINSTRUMENT_FOR_PROMETHEUS
LIBS = -lbcm2835 -lprom -lpromhttp -lmicrohttpd
else
CFLAGS = -Wall
@Zorono
Zorono / cap.sh
Created November 16, 2023 19:46 — forked from patillacode/cap.sh
#!/bin/bash
################################################################################
# cap - capture your screen
#
# This script allows you to capture your screen on Linux or macOS systems using
# the appropriate tools available on each platform. On Linux, it uses 'slop'
# and 'ffmpeg', while on macOS, it utilizes 'screencapture'. The script prompts
# you to select a desktop area for recording and saves the recording as an MP4/MOV
# file with customizable video quality.
@Zorono
Zorono / access.lua
Created November 5, 2023 07:16 — forked from mariocesar/access.lua
Nginx Lua script redis based for Basic user authentication
function password_encode(password)
local bcrypt = require 'bcrypt'
return bcrypt.digest(password, 12)
end
function check_password(password, encoded_password)
local bcrypt = require 'bcrypt'
return bcrypt.verify(password, encoded_password)
end
@Zorono
Zorono / 01.md
Created November 5, 2023 03:45 — forked from mtigas/01.md
HTTPS / SSL certificate config stuff

Normal SSL cert

export DATE=`date +"%Y%m"`
export SITENAME="mike_tig_as"
export KEYNAME="$DATE-$SITENAME"

# Generate private key, make it have no password.
# change to 2048 if you want compatibility with CDNs / aws cloudfront / load balancers, etc
openssl genrsa -aes256 -passout pass:xxxx -out "${KEYNAME}.pass.key" 4096
openssl rsa -passin pass:xxxx -in ${KEYNAME}.pass.key -out ${KEYNAME}.key
@Zorono
Zorono / nginx-config-auth-cert-ssl.md
Created November 5, 2023 03:40 — forked from alexishida/nginx-config-auth-cert-ssl.md
Tutorial to configure Nginx client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Original: https://gist.github.com/mtigas/952344

Convert SSL certificate from CRT format to PEM

openssl x509 -in server.crt -out server.der -outform DER
openssl x509 -in server.der -inform DER -out server.pem -outform PEM
@Zorono
Zorono / gist:6c6f6ba40ec35194dd0f9366d12524b5
Created November 5, 2023 03:39 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@Zorono
Zorono / curl_example.cpp
Created January 15, 2023 23:08 — forked from alghanmi/curl_example.cpp
cURL C++ Example
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
@Zorono
Zorono / ubuntu-hardening.md
Created December 3, 2022 17:21
List of things for hardening Ubuntu

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get autoclean
#!/bin/bash
#
# Author: Peter Maloney
# License: GPLv2
backed_up=false
now=$(date +%s)
file=/etc/ssh/sshd_config
support_applications=()
pubkeyonly=false
@Zorono
Zorono / gpsroute.inc
Created October 14, 2022 17:36
Simple GPS Route using player gang zones
#if defined __INC_GPS_ROUTE_
#endinput
#else
#define __INC_GPS_ROUTE_
#endif
/*
GPS Route Include by NaS
Shows a route on the radar from the player's location to the specified destination using per-player gang zones.