Skip to content

Instantly share code, notes, and snippets.

View blarghmatey's full-sized avatar

Tobias Macey blarghmatey

View GitHub Profile
@AlexRiina
AlexRiina / noqaer.py
Last active May 11, 2023 00:33
automatically ignore lines from flake8
"""
Add `# noqa: FXXX` comments to all lines with violations from flake8
"""
# MIT License
#
# Copyright (c) 2022 Alex Riina
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@themartorana
themartorana / fastlyMonthToDateBill.py
Last active May 13, 2020 19:07
Calculate your month-to-date bill from Fastly with the billing API
# Requires Python 3
import requests
import locale
from typing import Dict, Tuple, List
from calendar import monthrange
from datetime import datetime
FASTLY_URL = "https://api.fastly.com/stats/usage_by_month?billable_units=true"
#!/bin/sh
# in case it's already installled
vagrant plugin uninstall vagrant-libvirt
# vagrant's copy of curl prevents the proper installation of ruby-libvirt
sudo mv /opt/vagrant/embedded/lib/libcurl.so{,.backup}
sudo mv /opt/vagrant/embedded/lib/libcurl.so.4{,.backup}
sudo mv /opt/vagrant/embedded/lib/libcurl.so.4.4.0{,.backup}
sudo mv /opt/vagrant/embedded/lib/pkgconfig/libcurl.pc{,.backup}
@kfatehi
kfatehi / hb_all_books_dl.js
Last active March 7, 2021 08:07 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(MOBI|EPUB|PDF)$/i;
#cloud-init
# https://docs.chef.io/packages.html#enterprise-linux
# vendor chef-repo to /var/lib/chef with cookbooks in /var/lib/chef/cookbooks
yum_repos:
chef-stable:
name: chef-stable
baseurl: https://packages.chef.io/stable-yum/el/7/\$basearch/
enabled: true
failovermethod: priority
@barrywoolgar
barrywoolgar / hb_all_books_dl.js
Created September 2, 2016 11:06 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript.
This will download all the books in all the formats available.
*/
$('a').each(function(i){
if (['MOBI', 'PDF', 'EPUB'].indexOf($.trim($(this).text())) >= 0) {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@wvengen
wvengen / extend.sh
Last active April 22, 2024 14:02
Extend non-HiDPI external display above HiDPI internal display
#!/bin/sh
# extend non-HiDPI external display on DP* above HiDPI internal display eDP*
# see also https://wiki.archlinux.org/index.php/HiDPI
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'`
@micw
micw / install_jenkins_plugin.sh
Last active August 11, 2023 06:14
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
@sloria
sloria / bobp-python.md
Last active May 1, 2024 08:37
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens