Skip to content

Instantly share code, notes, and snippets.

@staaldraad
staaldraad / awk_netstat.sh
Last active October 30, 2024 16:16
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
@balupton
balupton / README.md
Last active July 4, 2018 18:15
Purchasing/Booking Flights Checklist

Purchasing/Booking Flights Checklist

Way before booking

  1. Visas
    1. Check out visa requirements
    2. Ensure you will have enough time to satisfy visa requirements. I generally minus 2 days from the maximum in case there are delays and whatnot.

Before Booking

anonymous
anonymous / bench.php
Created March 6, 2014 14:37
PHP benchmark
<?
function simple() {
$a = 0;
for ($i = 0; $i < 1000000; $i++)
$a++;
$thisisanotherlongname = 0;
for ($thisisalongname = 0; $thisisalongname < 1000000; $thisisalongname++)
$thisisanotherlongname++;
}
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@weavenet
weavenet / travel
Created October 31, 2013 14:21
In preparation for an international backpacking trip, I updated my travel checklist. Below is a list of things to pack, prepare and keep in mind while traveling.
## Equipment
### Hygiene
* Razor(s)
* Earplugs
* Eye Mask
* Baby Powder
* Chap Stick
* Antacid
@plentz
plentz / nginx.conf
Last active November 16, 2024 14:10
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@chayn1k
chayn1k / gist:6241806
Last active December 21, 2015 03:19 — forked from sapegin/gist:4510703
  • Картинки для ретины.
  • Фавиконка 16×16.
  • Фавиконка 32×32.
  • Иконки для Айоса и Андроида.
  • Счётчик.
  • Проверка битых ссылок.
  • 404-я страница.
  • RSS.
  • robots.txt.
  • humans.txt.
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"