Skip to content

Instantly share code, notes, and snippets.

@yzdann
yzdann / latency.txt
Created November 26, 2020 22:13 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@yzdann
yzdann / gist:e3de21556d10a93a54f897df4b4101f2
Created June 30, 2020 06:55 — forked from jtdp/gist:5443498
Revert file permission changes in local git repository.. Very useful when you change permissions due to working on a samba share. Lifted from: http://stackoverflow.com/questions/2517339/git-how-to-recover-the-file-permissions-git-thinks-the-file-should-be
git diff -p \
| grep -E '^(diff|old mode|new mode)' \
| sed -e 's/^old/NEW/;s/^new/old/;s/^NEW/new/' \
| git apply
@yzdann
yzdann / redis_cheatsheet.bash
Created June 20, 2020 11:30 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@yzdann
yzdann / jail.local
Last active May 9, 2020 06:08 — forked from Nihisil/jail.local
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@yzdann
yzdann / five_minutes.yml
Created March 29, 2020 13:59 — forked from ryane/five_minutes.yml
five_minutes.yml
---
- hosts: all
vars:
UBUNTU_COMMON_ROOT_PASSWORD: 'xxxxx'
UBUNTU_COMMON_DEPLOY_PASSWORD: 'xxxxx'
UBUNTU_COMMON_LOGWATCH_EMAIL: [email protected]
ubuntu_common_deploy_user_name: deploy
ubuntu_common_deploy_public_keys:
- ~/.ssh/id_rsa.pub
@yzdann
yzdann / nginx_test.sh
Created January 19, 2020 20:25 — forked from patmandenver/nginx_test.sh
A quick script to test 200, 404, and 500 errors on an nginx box (requires URLs that will result in 200, 404, and 500)
#!/bin/bash
#
# Author: Patrick Bailey
# License: MIT
#
# Set the percentage of 200, 404, and 500 errors you want
# Set the hourly rate you want
# Set a URL for 200, 404 and 500
#
# Then run it. it will suffle the 200, 404, and 500 urls
@yzdann
yzdann / tcp_flags.txt
Created January 19, 2020 08:48 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@yzdann
yzdann / README-Template.md
Created August 28, 2019 13:18 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@yzdann
yzdann / jqcheatsheet.md
Created August 21, 2019 14:45 — forked from talwrii/jqcheatsheet.md
jq cheatsheet

jq cheatsheet

Extract field from list of objects

jq 'map(.foo)'

[ { foo: 1 }, { foo: 2 } ]
[1, 2]