Skip to content

Instantly share code, notes, and snippets.

View karolsteve's full-sized avatar
🏠
Working from home

Steve Tchatchouang karolsteve

🏠
Working from home
View GitHub Profile
@karolsteve
karolsteve / flush-oracle.sh
Created March 16, 2025 17:51 — forked from SanjaySRocks/flush-oracle.sh
Remove all default firewall rules in oracle cloud permanently
# Take backup of iptables
cp /etc/iptables/rules.v4 /etc/iptables/rules.v4.backup
cp /etc/iptables/rules.v6 /etc/iptables/rules.v6.backup
# Flush rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
@karolsteve
karolsteve / JavaPasswordSecurity.java
Created December 15, 2024 14:15 — forked from jtan189/JavaPasswordSecurity.java
Java PBKDF2 Password Hashing Code
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca
@karolsteve
karolsteve / nginx-tuning.md
Created October 27, 2024 14:27 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@karolsteve
karolsteve / FormDataHandler.java
Created March 28, 2024 15:23 — forked from JensWalter/FormDataHandler.java
FormDataHandler for com.sun.net.httpserver.HttpHandler
package io.trivium.glue.binding.http;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
@karolsteve
karolsteve / openssl-build.sh
Created December 12, 2023 19:41 — forked from foozmeat/openssl-build.sh
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@karolsteve
karolsteve / https_nginx_express_node_config.md
Created October 31, 2023 15:11 — forked from basharovV/https_nginx_express_node_config.md
How to configure HTTPS with Lets Encrypt, Nginx reverse proxy, Express and Node

How to configure HTTPS with Lets Encrypt, Nginx reverse proxy, Express and Node

  1. Have a Node app ready for production.
  2. Create an app.js file in your project directory:
const express = require('express');
const path = require('path');
const app = express();

// Allow dotfiles - this is required for verification by Lets Encrypt's certbot

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "[email protected]"
@karolsteve
karolsteve / gist:c5e29bdacb25899ae36a3a4f632ae6eb
Created August 21, 2023 10:27 — forked from bobuss/gist:6515517
Tuning the Linux Kernel for many tcp connections

(from http://www.metabrew.com/article/a-million-user-comet-application-with-mochiweb-part-1)

Save yourself some time and tune the kernel tcp settings before testing with lots of connections, or your test will fail and you’ll see lots of Out of socket memory messages (and if you are masquerading, nf_conntrack: table full, dropping packet.)

Here are the sysctl settings I ended up with - YMMV, but these will probably do:

$ cat /etc/sysctl.conf
# General gigabit tuning:
net.core.rmem_max = 16777216