Skip to content

Instantly share code, notes, and snippets.

@devlucas
devlucas / sh
Created April 15, 2018 19:21
Tracks all subprocess of a given command
valgrind --tool=none --trace-children=yes <command goes here>
@devlucas
devlucas / local-dns.md
Last active March 29, 2018 03:13
Run a local DNS server and have /etc/resolv.conf configured correctly on linux

If you ended up here looking for how to make your "nameserver 127.0.0.1" stick around nowadays, edit your /etc/resolvconf.conf and add the following:

# Defaults to /etc/resolv.conf if not set.

resolv_conf=/etc/resolv.conf

# Prepend name servers to the dynamically generated list.
# You should set this to 127.0.0.1 if you use a local name server other than libc.
@devlucas
devlucas / driverfor.sh
Created February 10, 2018 14:28
Finds out which kernel driver is being used to serve a given device file.
#!/usr/bin/env bash
# call as: <script name> <device file path>
# example: driverfor /dev/input/mouse0
lookup_driver_in_use_for_input_device() {
device_file="$(echo $1 | awk '{gsub("/dev/", "", $1); print $1}')"
module_file="$(realpath /sys/class/$device_file/device/device/driver/module)"
echo $module_file | awk '{gsub("/sys/module/", "", $1); print $1}'
@devlucas
devlucas / Vagrantfile
Created February 19, 2017 02:18
Simple Vagrantfile that checks for required plugins and installs them when they are missing.
# -*- mode: ruby -*-
required_plugins = %w(vagrant-exec vagrant-vbguest)
plugins_to_install = required_plugins.select do |plugin|
!Vagrant.has_plugin? plugin
end
unless plugins_to_install.empty?
puts "Installing plugins: #{plugins_to_install.join(' ')}"
@devlucas
devlucas / jenkins-install.sh
Created February 6, 2014 00:20
Jenkins Install script for Debian and Ubuntu. Must be executed as root
#!/bin/bash
# Jenkins install script for debian and ubuntu
# Jenkins
echo "Installing Jenkins CI Server"
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list
apt-get -y update
apt-get -y install jenkins