Skip to content

Instantly share code, notes, and snippets.

View afeish's full-sized avatar
🎯
Focusing

afeish afeish

🎯
Focusing
View GitHub Profile
@afeish
afeish / Netfilter-IPTables-Diagrams.md
Created April 8, 2022 02:53 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@afeish
afeish / bind-mount.md
Last active March 4, 2022 09:31
test linux bind mount propogation

test with linux bind propogation

dd if=/dev/zero of=01.img bs=512 count=2880 conv=notrunc
dd if=/dev/zero of=02.img bs=512 count=2880 conv=notrunc

sudo losetup /dev/loop100 01.img
sudo losetup /dev/loop101 02.img

losetup -a
@afeish
afeish / cell-tests.rs
Created December 1, 2021 06:24 — forked from jonhoo/cell-tests.rs
cell-refcell-rc
// these aren't _quite_ functional tests,
// and should all be compile_fail,
// but may be illustrative
#[test]
fn concurrent_set() {
use std::sync::Arc;
let x = Arc::new(Cell::new(42));
let x1 = Arc::clone(&x);
std::thread::spawn(move || {
@afeish
afeish / gist:5c81fdef62c8857590fb97707650dc77
Created September 28, 2020 02:22
progressing-bar using python
import time
scale = 50
print("starting".center(scale // 2,"-"))
start = time.perf_counter()
for i in range(scale + 1):
a = "*" * i
b = "." * (scale - i)
c = (i / scale) * 100
dur = time.perf_counter() - start
print("\r{:^3.0f}%[{}->{}]{:.2f}s".format(c,a,b,dur),end = "")
@afeish
afeish / how-to.sh
Last active September 21, 2020 05:56 — forked from simonw/how-to.md
How to create a tarball of a git repository using "git archive"
# archive the entire repo
git archive --format=tar.gz -o fastone-upgrade-guide.tar.gz --prefix=fastone-upgrade-guide/ master
# archive the given directory[upgrade] of the repo
git archive --format=tar.gz -o fastone-upgrade-guide.tar.gz --prefix=fastone-upgrade-guide/ HEAD:upgrade/
@afeish
afeish / Welcome file.md
Last active October 22, 2019 03:06
Welcome file

Welcome to StackEdit!

Hi! I'm your first Markdown file in StackEdit. If you want to learn about StackEdit, you can read me. If you want to play with Markdown, you can edit me. Once you have finished with me, you can create new files by opening the file explorer on the left corner of the navigation bar.

Files

StackEdit stores your files in your browser, which means all your files are automatically saved locally and are accessible offline!

Create files and folders

@afeish
afeish / md-renderer.conf
Created September 12, 2018 10:49 — forked from max-lt/md-renderer.conf
Nginx config to render markdown files (client side)
location /__special {
internal;
allow all;
root /usr/share/nginx/html/__special;
}
location = /__md_file {
internal;
allow all;
@afeish
afeish / compile-nginx-from-source.sh
Created July 17, 2018 02:26 — forked from nurrony/compile-nginx-from-source.sh
All configuration files needed to install nginx on Ubuntu 16.04 Compile Nginx from source with nginx-rtmp-module, pagespeed and cache-purge module.
#change it to latest version
NPS_VERSION=1.11.33.0;
echo "Changing Directory to $HOME..."
cd $HOME;
echo "Nginx version to install: " && \
read NGINX_VERSION && \
echo "Downloading nginx-$NGINX_VERSION..." && \
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \
echo "Installing Nginx Dependencies..." && \
@afeish
afeish / cors-nginx.conf
Created July 10, 2018 03:21 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#