Skip to content

Instantly share code, notes, and snippets.

View dam2k's full-sized avatar

Dino Ciuffetti dam2k

View GitHub Profile
@u0d7i
u0d7i / disable_vim_auto_visual_on_mouse.txt
Last active February 27, 2024 14:08
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@taktran
taktran / rpi-led-notes.md
Last active July 22, 2022 14:20
Controlling Raspberry Pi 2 LEDs

Commands for controlling the Raspberry Pi 2 LEDs.

See rpi-leds for a node module that does this.

Power (PWR) LED

  • OK (ACT) LED = led0
  • Power (PWR) LED = led1

Allow access

@mash
mash / Makefile
Created November 4, 2014 09:59
udp server sample using libuv
LIBUV_HOME := $(HOME)/src/github.com/joyent/libuv
LIBUV := $(LIBUV_HOME)/build/Release/libuv.a
INC = $(LIBUV_HOME)/include
all:
gcc -o main -I$(INC) -Wall main.c $(LIBUV)
PHONY: all
@roxlu
roxlu / ssl_test2.c
Created March 28, 2014 15:12
Compact example of how to use openSSL with self signed (no password) keys/certificates, DTLS and memory BIOs
/*
Create server/client self-signed certificate/key (self signed, DONT ADD PASSWORD)
openssl req -x509 -newkey rsa:2048 -days 3650 -nodes -keyout client-key.pem -out client-cert.pem
openssl req -x509 -newkey rsa:2048 -days 3650 -nodes -keyout server-key.pem -out server-cert.pem
*/
#include <stdio.h>
@Goerik
Goerik / gist:6018092
Created July 17, 2013 06:26
Install zfs on Debian with transparent compression
wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_1%7Ewheezy_all.deb
dpkg -i zfsonlinux_1~wheezy_all.deb
apt-get update
apt-get install debian-zfs
modprobe zfs
fdisk -l
apt-get install parted
parted /dev/vda mklabel gpt
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 5, 2024 13:48
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jasny
jasny / mysql_splitdump.sh
Last active February 15, 2024 16:13
Split MySQL dump SQL file into one file per table or extract a single table
#!/bin/bash
####
# Split MySQL dump SQL file into one file per table
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump
####
if [ $# -lt 1 ] ; then
echo "USAGE $0 DUMP_FILE [TABLE]"
exit
@zaius
zaius / background.sh
Created January 16, 2011 23:29
How to redirect a running process output to a file and log out
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)