Skip to content

Instantly share code, notes, and snippets.

View ryancdotorg's full-sized avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
@epixoip
epixoip / sshd_config.diff
Created April 10, 2021 06:00
ssh pubkey auth only with libpam
--- /etc/ssh/sshd_config.orig 2021-04-10 05:50:44.673514864 +0000
+++ /etc/ssh/sshd_config 2021-04-10 05:59:56.316912290 +0000
@@ -31,7 +31,7 @@
# Authentication:
#LoginGraceTime 2m
-#PermitRootLogin prohibit-password
+PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
@dlenski
dlenski / cert_fingerprint_test.py
Last active February 26, 2024 09:05
Fingerprint-based certificate validation in Python (including pin-sha256)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This is a demonstration of how to do fingerprint-based certificate
# validation in Python, in the style of OpenConnect:
# https://gitlab.com/openconnect/openconnect/-/blob/HEAD/library.c#L1084-1143
#
# For Python <3.7, we monkey-patch ssl.SSLSocket directly, because ssl.SSLContext.sslsocket_class
# isn't available until Python 3.7. For Python 3.7+, we set ssl.SSLContext.sslsocket_class
# to our modified version (which is sort of monkey-patching too).
@AjkayAlan
AjkayAlan / WSLWindows10Setup.md
Last active April 6, 2024 10:02
Windows SubSystem For Linux setup that I like with some developers stuff mixed in

Setting Up WSL

Install A Distro:

  1. Run the following in powershell as admin Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Install a distro (ex: Ubuntu 18.04 LTS - https://www.microsoft.com/store/apps/9N9TNGVNDL3Q)

  3. Open your distro you installed via the start menu, let it setup

  4. Update and upgrade

sudo apt-get update
@cemeyer
cemeyer / ⁄etc⁄logrotate.conf
Last active October 22, 2023 12:06
Sane logrotate.conf settings
# create new (empty) log files after rotating old ones
create
# use date as a suffix of the rotated file
dateext
compress
compresscmd /bin/zstd
compressext .zst
compressoptions -18 -T0 --rm
@chankruze
chankruze / Compile-Vanila.md
Last active April 6, 2024 07:26
How To Compile OpenWrt Firmware For Any Router

Checking out Source

  • clone latest source repository by git clone https://www.github.com/openwrt/openwrt -b branch_name
  • Now change directory to openwrt by cd openwrt.This is our <buildroot dir> for this guide.

Updating Feeds

  • Update feeds: ./scripts/feeds update -a
  • Make downloaded package(s) available in make menuconfig:
    • single package : ./scripts/feeds install <PACKAGENAME>
    • all packages : ./scripts/feeds install -a

Image Configuration

@BigNerd95
BigNerd95 / regd_diff.c
Last active March 1, 2023 09:05
Atheros Country Code ART bypass passing a custom Country Name when loading the driver (e.g.: insmod ath cn=AU)
char *user_country_name = ""; // [MOD]
module_param_named(cn, user_country_name, charp, S_IRUGO); // [MOD]
MODULE_PARM_DESC(cn, "Country Name"); // [MOD]
static int __ath_regd_init(struct ath_regulatory *reg)
{
struct country_code_to_enum_rd *country = NULL;
u16 regdmn;
if (!reg)
@mimoo
mimoo / erase_from_memory.h
Last active April 8, 2024 21:17
Include this file to get the `erase_from_memory` function that zeros memory. See https://www.cryptologie.net/article/419/zeroing-memory-compiler-optimizations-and-memset_s/
#ifndef __ERASE_FROM_MEMORY_H__
#define __ERASE_FROM_MEMORY_H__ 1
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdlib.h>
#include <string.h>
void *erase_from_memory(void *pointer, size_t size_data, size_t size_to_remove) {
#ifdef __STDC_LIB_EXT1__
memset_s(pointer, size_data, 0, size_to_remove);
@apsun
apsun / myalloc.c
Last active October 18, 2023 12:04
A simple C memory allocator
/*
* myalloc - a simplified reimplementation of glibc's malloc
*
* This allocator aims to follow in the spirit of the glibc implementation,
* but with simplicity as the main design goal, instead of efficiency or
* scalability. It uses a single free list instead of grouping blocks
* into buckets, and is not at all thread safe.
*
* Some assumptions made:
* - 2's complement, little endian, 8 bits per byte
@hammady
hammady / solr.service
Created January 9, 2017 08:18
systemd service file for Apache SOLR
# put this file in /etc/systemd/system/ as root
# below paths assume solr installed in /opt/solr, SOLR_PID_DIR is /data
# and that all configuration exists in /etc/default/solr.in.sh which is the case if previously installed as an init.d service
# change port in pid file if differs
# note that it is configured to auto restart solr if it fails (Restart=on-faliure) and that's the motivation indeed :)
# to switch from systemv (init.d) to systemd, do the following after creating this file:
# sudo systemctl daemon-reload
# sudo service solr stop # if already running
# sudo systemctl enable solr
# systemctl start solr