Skip to content

Instantly share code, notes, and snippets.

""" Per-Filetype Scripts
" NOTE: These define autocmds, so they should come before any other autocmds.
" That way, a later autocmd can override the result of one defined here.
filetype on " Enable filetype detection,
filetype indent on " use filetype-specific indenting where available,
filetype plugin on " also allow for filetype-specific plugins,
syntax on " and turn on per-filetype syntax highlighting.
set numberwidth=1 " using only 1 column (and 1 space) while possible
@rcarmo
rcarmo / .zshrc
Last active December 25, 2023 06:41
My zsh configuration
# =======
# GLOBALS
# =======
if [[ "$(uname)" == "Darwin" ]]; then
platform="Darwin"
elif [[ "$(expr substr $(uname -s) 1 5)" == "Linux" ]]; then
platform="Linux"
else
platform="POSIX"
@rcarmo
rcarmo / bottle_github_webook_handler.py
Last active August 21, 2019 18:41
Bottle GitHub WebHook Handler
@post("/handler")
def gitdeploy():
signature = request.headers.get("X-Hub-Signature", None)
if not signature:
abort(400, "Invalid Request")
event = request.headers.get("X-GitHub-Event", None)
if event == "push":
hashed = "sha1=" + hmac.new(GITHUB_WEBHOOK_SECRET, request.body.read(), hashlib.sha1).hexdigest()
if signature == hashed:
# Do Stuff
@rcarmo
rcarmo / .tmux.conf
Last active April 17, 2021 23:01
Raspberry Pi tmux status bar
set-option -g status-right "#(/home/pi/status.sh) %H:%M %d-%b-%y"
@rcarmo
rcarmo / run.csx
Created July 2, 2019 10:08
Simple C# Function to query Azure SQL DB and return JSON reply
#r "Newtonsoft.Json"
using System.Text;
using System.Net;
using System.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Collections;
@rcarmo
rcarmo / bt-agent.service
Last active December 3, 2025 03:58
Set up PAN networking on Raspbian Stretch (use sudo to create these files and run all commands)
# in /etc/systemd/system
[Unit]
Description=Bluetooth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
WantedBy=multi-user.target
@rcarmo
rcarmo / build_qemu_debian_image.sh
Created June 19, 2019 14:02 — forked from sigmaris/build_qemu_debian_image.sh
Automate the installation of Debian Buster on a x86_64 QEMU 4.0.0 VM hosted on macOS
#!/bin/bash -e
if [ "$(uname -s)" != "Darwin" ]
then
echo "This script is for building a Debian x86_64 image to use on MacOS"
exit 1
fi
TEMP="$(mktemp -d build.XXXXX)"
cp preseed.cfg $TEMP
@rcarmo
rcarmo / gist:cbd315bf4b058c23b65505d4c0a7c99c
Created April 20, 2019 15:59 — forked from nosuchuser/gist:21db3fdd9f4b80bf0910f8b8b6ea2f63
dnsmasq.conf configuration for vodafone IPTV
server=/.iptvpoc.alu/.discovery.iptv.microsoft.com/.iptv.vodafone.pt/.iptvdiscovery/.ims.vodafone.pt/192.168.1.1
@rcarmo
rcarmo / Makefile
Created December 25, 2018 16:38
Backup HomeKit data
export SOURCE?=rcarmo@home.lan:~/.config/
export TARGET?=home.lan
export TAG_DATE=`date -u +"%Y%m%d"`
.PHONY: snapshot init
init:
mkdir -p $(TARGET)
git init
#!/bin/bash
# instant-rsyncd lets you quickly set up and start a simple, unprivileged rsync
# daemon with a single module in the current directory. I've found it
# invaluable for quick testing, and I use it when writing a list of commands
# that people can paste into a terminal to reproduce a daemon-related bug.
# Sysadmins deploying an rsync daemon for the first time may find it helpful as
# a starting point.
#
# Usage: instant-rsyncd MODULE PORT RSYNCD-USERNAME [RSYNC-PATH]