Skip to content

Instantly share code, notes, and snippets.

View helloimalemur's full-sized avatar
🦊

Koonts helloimalemur

🦊
View GitHub Profile
@helloimalemur
helloimalemur / server.py
Created September 8, 2022 19:22 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@helloimalemur
helloimalemur / example.service
Created September 8, 2022 22:53
example systemd .service file
[Unit]
Description=example
After=network.target
StartLimitInterval=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=myq
@helloimalemur
helloimalemur / discord_notif.sh
Created November 13, 2022 19:41
Bash Discord Notification
#!/bin/bash
## first parameter is message
## second parameter is url
WEBHOOK_URL=$2
JSON="{\"content\": \"$1\"}"
curl -d "$JSON" -H "Content-Type: application/json" "$WEBHOOK_URL"

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@helloimalemur
helloimalemur / pgp.md
Last active December 13, 2022 14:23 — forked from spencerdodd/pgp.md
pgp file encryption / decryption with GPG

generate new key-pair

gpg --full-generate-key #If you are not on version 2.1.17 or greater, the gpg --full-generate-key command doesn't work.
gpg --default-new-key-algo rsa4096 --gen-key

list keys

General OpenSSL Commands

These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.

Generate a new private key and Certificate Signing Request

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
@helloimalemur
helloimalemur / example.cs
Created January 22, 2023 13:41 — forked from brandonmwest/example.cs
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@helloimalemur
helloimalemur / dumprequest.php
Created February 1, 2023 17:18 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']
@helloimalemur
helloimalemur / my.cnf
Created February 27, 2023 15:42
General MySQL config
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@helloimalemur
helloimalemur / rocket-sqlx.rs
Created July 3, 2023 15:18 — forked from hendi/rocket-sqlx.rs
Rust: rocket with sqlx
#[macro_use] extern crate rocket;
use std::env;
use anyhow::Result;
use rocket::State;
use rocket::http::Status;
use sqlx::{Pool, Postgres};