Skip to content

Instantly share code, notes, and snippets.

View h0tw1r3's full-sized avatar
🏝️
Living the dream

Jeffrey Clark h0tw1r3

🏝️
Living the dream
View GitHub Profile
@h0tw1r3
h0tw1r3 / mellanox-linux-3.17-dkms.diff
Created January 6, 2015 18:03
Fix building Mellanox ConnectX EN Driver on Linux 3.17+ -- dkms tested on Fedora 3.17
diff -ur a/mlnx-en-2.3/dkms.conf b/mlnx_en-2.3/dkms.conf
--- a/mlnx-en-2.3/dkms.conf 2014-11-19 03:56:27.000000000 -0600
+++ b/mlnx_en-2.3/dkms.conf 2015-01-06 10:52:04.171696932 -0600
@@ -20,7 +20,7 @@
DEST_MODULE_LOCATION[3]=/kernel/drivers/net/ethernet/mellanox/mlx4
STRIP[3]=$STRIP_MODS
PRE_BUILD="./scripts/mlnx_en_patch.sh ${MLNX_EN_PATCH_PARAMS}"
-MAKE="make -j`grep ^processor /proc/cpuinfo | wc -l`"
+MAKE="make -j`grep ^processor /proc/cpuinfo| wc -l` EXTRA_CFLAGS+='-Wno-error=date-time' "
CLEAN="make clean"
@h0tw1r3
h0tw1r3 / bundle_osx_libs.py
Last active September 18, 2015 05:47
Recursively change dynamic library link paths for non-system libraries to be relative to the linked program and copy them to <program>/../libs. I use this in a cross-compile environment on linux.
#!/usr/bin/env python
# coding: utf-8
# Recursively change dynamic library link paths for non-system libraries
# to be relative to the linked program and copy them to <program>/../libs
#
# TODO: parse individual architectures (ever necessary?)
# modify temp lib instead of assuming path changes work
#
# Copyright: © 2015 Jeffrey Clark
@h0tw1r3
h0tw1r3 / mingw-copy-deps.sh
Created October 16, 2015 15:25
Recursively copy windows binary (dll/exe) dependencies from a sysroot (mingw toolchain) to the binaries directory.
#!/usr/bin/env bash
#
# Copyright: © 2015 Jeffrey Clark <https://github.com/h0tw1r3/>
# License: GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
#
set -o errtrace
error() {
echo "ERROR in $0 : line $1 exit code $2"
exit $2
$ git clone -b 1.22 https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
$ cd ..
$ mkdir ctng
$ cd rpi1
$ ct-ng menuconfig
@h0tw1r3
h0tw1r3 / ip_addresses.pp
Created July 23, 2016 01:53
Puppet 4+ snippets
$facts['networking']['interfaces'].each() |$name, $values| {
$bindings = $values.filter |$key,$value| {
$key =~ /^bindings6?$/
}
$bindings.each |$bindingtype,$addresses| {
$addresses.each |$value| {
notice( "${name} with ip ${value['address']}" )
}
}
}
@h0tw1r3
h0tw1r3 / raw2jpg.sh
Last active March 24, 2018 18:20
Parallel recursive RAW to JPEG + meta converter shell script
!/bin/env bash
#
# Parallel recursive RAW to JPEG + meta converter
#
# Output into relative JPEG directory
#
# Requires: dcraw, cjpeg, exiv2
# any argument means verbose...
if [ ${#} -ne 0 ]; then
#!/bin/sh
localectl set-locale LANG=en_US.utf8
timedatectl set-timezone America/Chicago
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
yum -y install puppetserver vim
map $remote_user $proxy_client_domain {
default $remote_user;
}
upstream newsline.linearcollider.org {
server 127.0.1.1:80;
}
upstream linearcollider.org {
server 127.0.2.1:80;
@h0tw1r3
h0tw1r3 / rpm_packages.rb
Created September 9, 2016 21:43
puppet fact for rpm _packages
require 'facter'
def hash_tree
Hash.new do |hash, key|
hash[key] = hash_tree
end
end
Facter.add(:packages) do
confine :osfamily => 'Redhat'
@h0tw1r3
h0tw1r3 / netaddr
Created October 13, 2016 01:37
Filter IPv4 addresses by network
#!/bin/bash
# NetAddr version 0.2 - Filter IPv4 addresses by network
# Copyright 2016 Jeffrey Clark <github.com/h0tw1r3>
# Copyright 2009 Ole Christian Tvedt <olechrt@stud.ntnu.no>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#