Skip to content

Instantly share code, notes, and snippets.

View dmolesUC's full-sized avatar

David Moles dmolesUC

View GitHub Profile
getent passwd | cut -f1 -d: | while read user; do crontab=$(sudo crontab -u $user -l 2>/dev/null) && echo -e "\n$user:\n$crontab"; done
@dmolesUC
dmolesUC / escape-uris.rb
Last active November 12, 2020 22:05
Escaping URIs in Ruby
#!/usr/bin/env ruby
# coding: utf-8
require 'addressable'
require 'cgi'
require 'erb'
require 'uri'
# base_url = 'https://user:password !$&' + "'" + '()*+,;=@host.domain/path:?#@-.+_~/ path!$&' + "'" + '()*+,;=.cgi'
# query = 'query1.-_~ *+,;=value1.-_~ *+'
@dmolesUC
dmolesUC / encoding-problems.sh
Created August 5, 2021 19:36
Grep command to locate possible Windows 1252 <-> UTF-8 encoding problems
# After https://www.i18nqa.com/debug/utf8-debug.html
#
# A more sophisticated version of this would grep for suspicious sequences-of-sequences;
# if the file legit contains accented characters, this will show it as a false positive
find . -name marc.xml -exec env LANG=LC_ALL grep -Pl '(\xc2|\xc3|\xc5|\xc6|\xcb|\xe2)' {} \;
@dmolesUC
dmolesUC / LICENSE.md
Last active February 2, 2022 16:56
Quick and dirty Sprockets wrapper fror https://github.com/ntkme/sass-embedded-host-ruby

The MIT License (MIT)

Copyright © 2021 The Regents of the University of California

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: