Skip to content

Instantly share code, notes, and snippets.

View vjt's full-sized avatar
💭
looking at the stars

Marcello Barnaba vjt

💭
looking at the stars
View GitHub Profile
@vjt
vjt / copy-from-time-machine.sh
Last active March 8, 2024 17:05
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
@vjt
vjt / remote-tcpdump.md
Last active March 8, 2024 07:29
tcpdump on remote host

Running tcpdump on remote hosts with no storage

If you have tcpdump on your embedded home router and you want to see what traffic your crippled phone is doing, you can dump traffic on the router and visualise it on your main workstation using wireshark.

  1. On the remote host, create a FIFO
remotehost# mkfifo /tmp/tcpdump
@vjt
vjt / conf.apache
Created February 22, 2012 15:32
GRC (Generic Colouriser/Colorizer) configuration for Apache / nginx access logs
# Configuration suitable to display Apache/nginx access logs
# Based on conf.proftpd by Pavol Domin
# Crafted by Marcello Barnaba <vjt@openssl.it>
# Get GRC at http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
#
# ip number
regexp=^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=bold magenta
@vjt
vjt / awesome-nginx.conf
Created January 31, 2011 19:43
*AWESOME* nginx configuration for Ruby/Rack web applications
#
# mmm m m mmm mmm mmm mmmmm mmm
# " # "m m m" #" # # " #" "# # # # #" #
# m"""# #m#m# #"""" """m # # # # # #""""
# "mm"# # # "#mm" "mmm" "#m#" # # # "#mm"
#
# nginx configuration For Ruby/Rack web applications
#
# Cooked up with style, care and a bit of *secret*
# nerdy spice. :-)
@vjt
vjt / antani_require.rb
Created January 11, 2011 13:56
ruby require tree
# Wanna debug who the hell is requiring that damn gem
# you don't wanna see on earth? Here we go! :-)
#
# debugger rescue nil is required (ha ha) because, if
# you require ruby-debug, the debugger method will be
# defined *before* all debugger components are loaded
#
# Please note that, because this method is defined in
@vjt
vjt / painless-newline.md
Created August 12, 2020 11:01
Painless scripting language literal newline character
@vjt
vjt / 2fa
Last active May 12, 2023 11:28
2FA from the mac command line using oathtool-toolkit without much fuss
#!/bin/bash
# -*- 2fa Command Line -*-
#
# Uses oath-toolkit http://nongnu.org/oath-toolkit/
# to generate 2FA OTPs and copies them in the Mac's
# clipboard using pbcopy(1). For other UNIX systems
# you can just strip the pbcopy at the bottom.
#
# In the dir below you should put TOTP token seeds,
@vjt
vjt / wsus-cleanup.ps1
Created June 12, 2013 23:30
WSUS Cleanup Script that logs to the Windows Event Log
# Performs a cleanup of WSUS and writes to a custom "WSUS Cleanup" log
# You must create the Event Log using
#
# New-EventLog -LogName "WSUS Cleanup" -Source "Script"
#
# the first time you run this script.
# PowerShell 2.0 required.
#
# - vjt@openssl.it (feeling dirty)
#
@vjt
vjt / .bashrc
Last active December 8, 2021 19:53
#
# ~ vjt's .profile
#
export HOME
PS1=" \[\033[1;31m\]\t \[\033[1;32m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h\[\033[1;31m\]:\[\033[1;33m\]\w\[\033[0;0m\]\n \[\033[1;34m\]\\$\[\033[0m\] "
if [ -x $(which rust-vcprompt) ]; then
export VCP_PREFIX=" "
export VCP_NAME="{value}:" # You can use "value" or "symbol" here
@vjt
vjt / .tmux.conf
Created April 26, 2021 09:04
vjt's tmux.conf
#
# -*- ~/.tmux.conf -*-
# - vjt@openssl.it -
#
set -g mouse on
set -g monitor-activity on
set -g default-terminal "screen-256color"
set -g repeat-time 200
set -g clock-mode-style 12