Skip to content

Instantly share code, notes, and snippets.

@glacjay
glacjay / tun-ping-linux.py
Created September 18, 2010 04:49
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2
@peterk87
peterk87 / bitbucket_dark.css
Created January 16, 2014 21:36
CSS: bitbucket.org dark theme
/*bitbucket.org dark css theme*/
body, aside {
background: #222 !important;
background-color: #222 !important;
color: #bbb !important;
}
h1, h2, h3, h4, h5, span {
background-color: transparent !important;
color: #FFC963 !important;
@pubkey
pubkey / corsair_headset_linux.bash
Last active November 10, 2023 10:53
Corsair Gaming VOID Headset on Linux
# Corsair headsets will stuck the apps on your linux system. This is due to wrong usb-mapping.
# thx to http://www.c0urier.net/2016/corsair-gaming-void-usb-rgb-linux-fun
# 1. open terminal
# 2. type this and search the line with your headset
lsusb
# Get the USB ID of the headset and add it to xorg.conf:
@18516329677
18516329677 / usb_reset.py
Created July 6, 2017 08:08 — forked from PaulFurtado/usb_reset.py
Reset USB device from python
"""
Example code for resetting the USB port that a Teensy microcontroller is
attached to. There are a lot of situations where a Teensy or Arduino can
end up in a bad state and need resetting, this code is useful for
"""
import os
import fcntl
import subprocess
@william8th
william8th / .tmux.conf
Last active July 4, 2024 11:36
Tmux open new pane in same directory
# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
@srugano
srugano / noroot_tcpdump.sh
Created October 9, 2021 12:23
Enable tcpdump for non-root users on Debian/Ubuntu.
#!/usr/bin/env bash
# NOTE: This will let anyone who belongs to the 'pcap' group
# execute 'tcpdump'
# NOTE2: User running the script MUST be a sudoer. It is
# convenient to be able to sudo without a password.
sudo groupadd pcap
sudo usermod -a -G pcap $USER