This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to add or update firewalld policy | |
add_or_update_firewalld_policy() { | |
local protocol=$1 | |
local port=$2 | |
local zone=$3 | |
# Check if the rule already exists | |
if firewall-cmd --zone=$zone --query-port=$port/$protocol; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/Users/jeff/brew/bin/github-to-sqlite", line 8, in <module> | |
sys.exit(cli()) | |
File "/Users/jeff/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1128, in __call__ | |
return self.main(*args, **kwargs) | |
File "/Users/jeff/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1053, in main | |
rv = self.invoke(ctx) | |
File "/Users/jeff/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1659, in invoke | |
return _process_result(sub_ctx.command.invoke(sub_ctx)) | |
File "/Users/jeff/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1395, in invoke |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; To run export from Bash: | |
;; emacs -batch -l ~/.emacs.d/init.el -eval "(org-agenda-export-to-ics)" -kill | |
;; if [[ "$?" != 0 ]]; then | |
;; notify-send -u critical "exporting org agenda failed" | |
;; fi | |
(setq org-directory "~/Dropbox/org/") | |
(defun set-org-agenda-files () | |
"Set different org-files to be used in `org-agenda`." | |
(setq org-agenda-files (list (concat org-directory "things.org") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# dependencies: | |
# - antiword & pandoc: installable with the package manager in any major distro | |
# - html2csv: `pip install html-to-csv` | |
antiword -x db "$1" | pandoc --from=docbook --to=html | html2csv - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
3-20-14 | |
Copyright Steven Mullins 2014 | |
ATTiny45 | |
60Khz Transmitter | |
Modulated with WWVB signal | |
Source: https://www.instructables.com/WWVB-radio-time-signal-generator-for-ATTINY45-or-A/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: bandie91 | |
# Source: https://www.commandlinefu.com/commands/view/9775/draw-kernel-module-dependancy-graph | |
lsmod | perl -e 'print "digraph \"lsmod\" {";<>;while(<>){@_=split/\s+/; print "\"$_[0]\" -> \"$_\"\n" for split/,/,$_[3]}print "}"' | dot -Tpng | display - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tristan's Foot Pedals and Latency Tester Arduino Program | |
// Provides 5 buttons: left click, right click, scroll up, scroll down, latency test | |
// If you don't want all of these you can comment out the buttons you don't need. | |
#define BOUNCE_LOCK_OUT | |
#include <Bounce2.h> | |
#include "Keyboard.h" | |
const int scrollInterval = 80; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" courtesy of the gocode autocompletion project | |
" https://github.com/nsf/gocode/blob/9d1e0378d35b0527c9aef0d17c0913fc38d88b81/vim/autoload/gocomplete.vim#L6-L19 | |
fu! s:dumpCurrentBuffer() | |
let buf = getline(1, '$') | |
if &encoding != 'utf-8' | |
let buf = map(buf, 'iconv(v:val, &encoding, "utf-8")') | |
endif | |
if &l:fileformat == 'dos' | |
" XXX: line2byte() depend on 'fileformat' option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FlaskSubpath(Flask): | |
def __init__(self, *args, application_root="/", **kwargs): | |
super().__init__(*args, **kwargs) | |
self.application_root = application_root | |
def wsgi_app(self, environ, start_response): | |
if environ["PATH_INFO"].startswith(self.application_root): | |
environ["PATH_INFO"] = environ["PATH_INFO"][len(self.application_root):] | |
environ["SCRIPT_NAME"] = self.application_root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Make a PDF look scanned. | |
# Extracted from https://github.com/baicunko/scanyourpdf and modified for smaller output files (compression lower density). | |
INPUT_FILE=$1 | |
/usr/local/bin/convert -density '80' ${INPUT_FILE} -colorspace 'gray' -linear-stretch '3.5%x10%' \ | |
-blur '0x0.5' -attenuate '0.25' +noise Gaussian -rotate 0.5 \ | |
-compress lzw -quality 50 scanned_${INPUT_FILE} |
NewerOlder