Skip to content

Instantly share code, notes, and snippets.

View guyhughes's full-sized avatar

guy hughes guyhughes

  • /boot/efi/vmlinuz+0x0
View GitHub Profile
@samstokes
samstokes / regex-groups-global.rb
Created November 18, 2009 03:28
How to extract groups from a regex match in Ruby without globals or temporary variables. Code snippets supporting http://blog.samstokes.co.uk/post/251167556/regex-style-in-ruby
if "[email protected]" =~ /@(.*)/
$1
else
raise "bad email"
end
# => "example.com"
server {
listen 80;
server_name openvbx.local;
root /u/apps/openvbx;
access_log /var/log/nginx/openvbx.local.access.log;
error_log /var/log/nginx/openvbx.local.error.log;
index index.php;
if ($request_filename !~ (js|css|jpg|png|gif|robots\.txt|index\.php.*) ) {
rewrite ^(.*)$ /index.php?vbxsite=$1 last;

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 20, 2024 03:08
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mattratleph
mattratleph / vimdiff.md
Last active October 16, 2024 17:26 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@bdd
bdd / reset-auth.zsh
Last active July 28, 2022 15:32
Reset SSH agent socket and Kerberos credentials cache environment variables.
# -*- mode: shell-script -*-
#
# reset-auth.zsh
#
# When reattaching to a tmux (or screen session) authentication forwarding and
# delegation environment variables needs to be reset.
#
# Shell functions below can reset forwarded SSH Agent socket and Kerberos
# credentials cache environment variables by discovering and testing validity
# (ssh-agent only) on the remote machine.
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
@scy
scy / README.md
Last active August 21, 2024 07:50
My OSX PF config for #30C3.

My OS X “VPN only” Setup For #30C3

You should never let passwords or private data be transmitted over an untrusted network (your neighbor’s, the one at Starbucks or the company) anyway, but on a hacker congress like the #30C3, this rule is almost vital.

Hackers get bored easily, and when they’re bored, they’re starting to look for things to play with. And a network with several thousand connected users is certainly an interesting thing to play with. Some of them might start intercepting the data on the network or do other nasty things with the packets that they can get.

If these packets are encrypted, messing with them is much harder (but not impossible! – see the end of this article). So you want your packets to be always encrypted. And the best way to do that is by using a VPN.

Target audience

@guyhughes
guyhughes / cheatsheet-for-grml.md
Last active April 20, 2016 14:15
Cheatsheet for GRML luks lvm resize

luks and lvm

lsblk
cryptsetup luksOpen /dev/sde³ vg
vgscan
vgchange -ay
vgscan
TAGS := .tags
OUT := out
DEBUG_CFLAGS:=-Wextra -Wall -Wshadow -Wno-strict-aliasing -Woverflow -Wno-unused-parameter -Wno-unused-variable -g -pipe -march=native
CFLAGS:= -pipe -O2 -march=native
.PHONY: default debug tags out_run
out_run: run
./$(OUT)
out:
$(CC) $(CFLAGS) *.c -o $(OUT)
debug: