Skip to content

Instantly share code, notes, and snippets.

# Builds a 64-bit grub image in the default EFI bootloader location.
mkdir '/boot/efi/EFI/boot'
grub-mkimage --directory '/usr/lib/grub/x86_64-efi' --prefix '(hd0, gpt1)' --output '/boot/efi/EFI/boot/bootx64.efi' --format 'x86_64-efi' --compression 'auto' 'fat' 'part_gpt' 'ext2'
# Add grub to the EFI boot manager
efibootmgr -c -g -d /dev/sda -p 1 -w -L "Grub" -l /boot/efi/EFI/boot/bootx64.efi
@PaulFurtado
PaulFurtado / usb_reset.py
Last active June 22, 2024 22:44
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
@PaulFurtado
PaulFurtado / init
Created October 21, 2014 02:17
Script to run arch with any kernel version in DigitalOcean
#!/bin/sh
# Digital Ocean stores the arch kernel outside of the VM's disk and the hypervisor boots the
# kernel directly. This hack allows you to boot any arch kernel version by using kexec to
# basically turn the DO-provided kernel into a bootloader.
#
# By default, the DO kernel is started with /sbin/init as its command line and /sbin/init
# is a symlink to /usr/lib/systemd/systemd. By replacing /sbin/init with this shell script
# which calls kexec, we can boot a kernel on the VM's disk.
@PaulFurtado
PaulFurtado / gist:a0f5087692f365670204
Created February 18, 2015 07:42
/etc/dhclient.conf
send host-name = pick-first-value(gethostname(), "ISC-dhclient");
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name, domain-search;
@PaulFurtado
PaulFurtado / bash_history.sh
Created September 24, 2015 02:01
bashrc custom history
__lastcmd="$(history 1 | sed 's/^[ ]*[0-9]\+[ ]*//')"
HISTORY_FILE=~/.bash_eternal_history
function __prompt_cmd() {
local lastexit="$?"
local cmdstr="$(history 1 | sed 's/^[ ]*[0-9]\+[ ]*//')"
local logstr="DATE='$(date -Iseconds)' PID=$$ USER=$USER PWD='$PWD' EXIT_CODE=$lastexit COMMAND=$cmdstr"
if [[ "$cmdstr" != "$__lastcmd" ]] ; then
@PaulFurtado
PaulFurtado / build_log
Created August 12, 2016 06:47
gevent build failure
CFLAGS=-std=c99 python setup.py build
Running 'make ' in /home/pfurtado/dev/gevent
/home/pfurtado/dev/gevent-env/bin/python util/cythonpp.py -o gevent.corecext.c --module-name gevent.libev.corecext.pyx src/gevent/libev/corecext.ppyx
Running cython -o /tmp/tmplSC1TL/gevent.corecext.c -I src/gevent/libev -I src/gevent /tmp/tmplSC1TL/gevent.libev.corecext.pyx # !EV_USE_SIGNALFD && defined(LIBEV_EMBED) && !defined(_WIN32) hash:8d0d56cd291af2de92ce1cb35c306dc8Running cython -o /tmp/tmp7nPHjU/gevent.corecext.c -I src/gevent/libev -I src/gevent /tmp/tmp7nPHjU/gevent.libev.corecext.pyx # !EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32) hash:b617980bd87606c53168a4bbb866b468
Running cython -o /tmp/tmpmEp5lM/gevent.corecext.c -I src/gevent/libev -I src/gevent /tmp/tmpmEp5lM/gevent.libev.corecext.pyx # EV_USE_SIGNALFD && defined(LIBEV_EMBED) && defined(_WIN32) hash:e3c6772cd0e5d6f10667bf1e44bb443e
Running cython -o /tmp/tmp8DRTL9/gevent.corecext.c -I src/gevent/libev -I src/gevent /tmp/tmp8DRTL9/gevent.lib
@PaulFurtado
PaulFurtado / gevent_bad_run_log
Created August 12, 2016 07:07
gevent run log when using failed build
/usr/share/hubspot/mesos/slaves/86ba9c2c-2d98-444d-89c9-21167b58fd4a-S39/frameworks/sy3x3/executors/32y3n/runs/300e6114-4795-41a8-9505-faebab447ebc/tqdash_web-web-14_19_19-1470964906090-1-quick_base.iad03.hubspot_networks.net-us_east_1e/app/.deploy_virtualenv/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6
DeprecationWarning
Traceback (most recent call last):
File "/usr/share/hubspot/mesos/slaves/86ba9c2c-2d98-444d-89c9-21167b58fd4a-S39/frameworks/sy3x3/executors/32y3n/runs/300e6114-4795-41a8-9505-faebab447ebc/tqdash_web-web-14_19_19-1470964906090-1-quick_base.iad03.hubspot_networks.net-us_east_1e/app/.deploy_virtualenv/lib/python2.6/site-packages/gevent/corecffi.py", line 18, in <module>
import gevent._corecffi
ImportError: /usr/share/hubspot/mesos/slaves/86ba9c2c-2d98-444d-89c9-21167b58fd4a-S39/frameworks/sy3x3/executors
@PaulFurtado
PaulFurtado / kubelet-flamegraph.svg.gz
Last active September 21, 2017 01:05
kubelet-flamegraph.svg.gz
# Copyright (C) 2006-2016 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is