Skip to content

Instantly share code, notes, and snippets.

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

hatem ben tayeb hatembentayeb

🏠
Working from home
View GitHub Profile
git tag -am "annotation goes here" tagname_goes_here # cut a tag
git tag -d tagname_goes_here # burn it
git tag -am "annotation goes here" tagname_goes_here # cut another tag
git push --tags # push tags to remote
git push origin :refs/tags/tagname_goes_here # delete tag from remote
@denji
denji / nginx-tuning.md
Last active July 20, 2024 17:33
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

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.

@mcgirr
mcgirr / emoji.rs
Created April 4, 2015 22:20
Print the martini Emoji 🍸 in the Rust programming language from a Unicode character code
fn main ()
{
let martini_emoji = '\u{1F378}';
println!("{}", martini_emoji);
}
@hivefans
hivefans / shell_output.go
Last active May 12, 2024 10:36
get the realtime output for a shell command in golang|-|{"files":{"shell_output.go":{"env":"plain"}},"tag":"bigdata"}
package main
import (
"bufio"
"fmt"
"io"
"os"
"os/exec"
"strings"
)
@aliok
aliok / jenkinsfile-commons.groovy
Created April 26, 2017 12:35
Sample advanced Jenkins pipeline
/**
* This file provides common stuff to be used in the pipelines.
* It is important to load it after repo checkout is done: see https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#triggering-manual-loading
*
*/
/**
* Dumps some info about the environment.
* @return
*/
@drfill
drfill / gist:c18308b6d71ee8032efda870b9be348e
Created October 26, 2017 17:58 — forked from Mindgames/gist:556dc7d1e452d0cefcb7
Amazon S3 download with Curl
#!/bin/sh
file=path/to/file
bucket=your-bucket
resource="/${bucket}/${file}"
contentType="application/x-compressed-tar"
dateValue="`date +'%a, %d %b %Y %H:%M:%S %z'`"
stringToSign="GET
${contentType}
${dateValue}
${resource}"
@5car1z
5car1z / fail2ban-playbook.yml
Last active December 9, 2023 18:42
Simple Ansible playbook to install Fail2ban.
---
- name: installs fail2ban on ansible hosts
hosts: fail2ban-hosts
become: yes
tasks:
- name: install apt fail2ban packages
apt:
name: "{{ item }}"
state: latest
@marcopaga
marcopaga / lets-encrypt-wildcard-certs-using-azure-dns-on-aks.md
Last active November 2, 2022 09:52
Let's encrypt wildcard TLS certificates for Azure DNS using cert-manager on AKS (Azure Kubernetes Service)

This gist will guide you through the setup of a wildcard Let's encrypt TLS certificate.

Let's encrypt

Let’s encrypt is one of a new kind of Certificate Authority. You can get a TLS certificate from them for your website free of charge and without any manual overhead. These certificates are trusted in most browsers that are out there and will show up as valid. Instead of sending Mails or even paper around you can call an API and prove your domain ownership with simple challenges. Basically you call the API with a hostname or domain name you need a TLS certificate for and you get back a challenge string that you need to put in a well known location on your http host or as a txt record in your dns system.

The little helper for Kubernetes: Cert-Manager

You can find many clients that manage the proces

@6aditya8
6aditya8 / nginx.conf
Last active July 7, 2022 08:00
Nginx SSL/TLS configuration for getting "A+" in Qualys SSL Labs test
# Configuration options are limited to SSL/TLS
# Enable SSL session caching for improving performance by avoiding the costly session negotiation process where possible
# SSL Labs doesn't assume that SNI is available to the client, so it only tests the default virtual server
# setting this globally to make it work across all the nginx virtual servers (including the default virtual server)
ssl_session_cache shared:ssl_session_cache:10m;
ssl_session_timeout 10m;
server {
listen 443 ssl;
@hatembentayeb
hatembentayeb / Dockerfile
Last active November 10, 2019 03:43
My Dockerfile for a Rust Project
FROM rustdocker/rust:nightly as cargo-build
RUN apt-get update
RUN apt-get install musl-tools -y
RUN /root/.cargo/bin/rustup target add x86_64-unknown-linux-musl
RUN USER=root /root/.cargo/bin/cargo new --bin material
WORKDIR /material
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN RUSTFLAGS=-Clinker=musl-gcc /root/.cargo/bin/cargo build --release --target=x86_64-unknown-linux-musl --features vendored
RUN rm -f target/x86_64-unknown-linux-musl/release/deps/material*