Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am esavier on github.
  • I am esavier (https://keybase.io/esavier) on keybase.
  • I have a public key ASB6k_SUac3IAys2xmX-7brCoU0sFs743GLLHGVSUxcHJQo

To claim this, I am signing this object:

@esavier
esavier / gist:ef82c96aff79d64a2851a1f4db884744
Created Oct 31, 2019 — forked from andrewlkho/gist:e9a8c996c4bc1df23cd2
How to secure debian with two factor authentication (TOTP/HOTP)
View gist:ef82c96aff79d64a2851a1f4db884744

First, install the necesssary packages:

% apt-get install libpam-oath oathtool

Generate a key and write it to /etc/users.oath (NB the key will be in hexadecimal; if you are using Authy you will want to convert it to BASE32):

% KEY=$( head -c 1024 /dev/urandom | openssl sha1 | awk '{ print $2 }' )
% echo "HOTP/T30/6 andrewlkho - ${KEY}" >> /etc/security/users.oath
% chmod 600 /etc/users.oath
View gist:ea3ec7db5aa858a64bbeea405096707c
#ifdef DEBUG
#define _DEBUG(fmt, args...) printf("%s:%s:%d: "fmt, __FILE__, __FUNCTION__, __LINE__, args)
#else
#define _DEBUG(fmt, args...)
#endif
View screen_cheatsheet.markdown

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r <session_name>
@esavier
esavier / shell_bind_tcp.c
Created Sep 29, 2019 — forked from geyslan/shell_bind_tcp.c
Shell Bind TCP in C Language (Linux/x86) - forlife
View shell_bind_tcp.c
// This is a snippet of the original file in https://github.com/geyslan/SLAE/blob/master/1st.assignment/shell_bind_tcp.c
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
View building-static-nginx.txt
# Building static nginx for teh lulz
#
# basic dependencies
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev
# download nginx and openssl
wget http://nginx.org/download/nginx-1.5.6.tar.gz
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6