Skip to content

Instantly share code, notes, and snippets.

View brennen's full-sized avatar

Brennen Bearnes brennen

View GitHub Profile
@brennen
brennen / lst
Last active May 28, 2020 07:13
for gavcloud
[bash] brennen@inertia 23:38:02 ~/fragments/xargs-alias (master m0/u0) $ ls
example_selection files.lftp lst.sh
[bash] brennen@inertia 23:38:06 ~/fragments/xargs-alias (master m0/u0) $ cat example_selection
Datach'i - Bonus - 01 Aldebaran.mp3
Datach'i - Bonus - 02 Something.mp3
[bash] brennen@inertia 23:38:08 ~/fragments/xargs-alias (master m0/u0) $ cat lst.sh
function lst {
echo -n '' > files.lftp
sed "s/'/\\\'/" example_selection | while read -r fname; do
printf "put '%s'\n" "$fname" >> files.lftp
@brennen
brennen / func-stdin.txt
Created May 31, 2019 20:32
read stdin in a shell function
brennen@inertia 14:31:49 ~/fragments (master m2/u4) ▣ cat func-stdin.sh
#!/bin/sh
myread () {
while read foo; do
echo "$foo";
done
}
cat /etc/motd | myread
FROM docker-registry.wikimedia.org/dev/stretch-php72-apache2
RUN groupadd -o -g "65533" -r "somebody" && useradd -o -m -d "/home/somebody" -r -g "somebody" -u "65533" "somebody" && mkdir -p "/var/www/html" && chown "65533":"65533" "/var/www/html"
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html/
COPY --chown=65533:65533 [".", "."]
brennen@inertia 16:57:39 ~/code/wmf/releng/dev-images (master 0/0) ▣ make
docker-pkg --info -c dockerfiles/config.yaml build dockerfiles
Traceback (most recent call last):
File "/home/brennen/.local/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py", line 453, in wrap_socket
cnx.do_handshake()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1426, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1174, in _raise_ssl_error
_raise_current_error()
File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue
# This works when run from a shell:
#!/bin/sh
tmpfile=`mktemp /tmp/edit-clipboard.XXXXXX`
xclip -d localhost:1 -o > "$tmpfile"
"$EDITOR" "$tmpfile"
xclip -d localhost:1 -i "$tmpfile"
rm "$tmpfile"
# This doesn't work:
@brennen
brennen / checkmail.py
Last active June 15, 2017 16:23
checkmail.py
#!/usr/bin/env python
from imapclient import IMAPClient
import time
import RPi.GPIO as GPIO
DEBUG = True
HOSTNAME = 'imap.gmail.com'
#!/usr/bin/env php
<?php
define('LIBDIR', 'lib/');
require LIBDIR . 'classes/SparkLib/Autoloader.php';
SparkLib\Autoloader::setup();
use FeedWriter\Feed;
use FeedWriter\View\JSON;
use FeedWriter\View\XML;
use FeedWriter\View\CSV;
@brennen
brennen / snowday.pl
Last active December 16, 2015 08:39
Is it a snow day?
#!/usr/bin/env perl
use LWP::Simple;
$page = get('http://www.bvsd.org/');
if ($page =~ /troublebutton/m) {
print "yes.\n";
} else {
print "sorry.\n";
}
^ # start
(
(?U) # ??? - named capture group?
.+ # one or more of anything
\.php) # a literal ".php", but why the fuck is there a paren at the end of it?
(
(function( $ ){
var methods = {
init : function (options) {
},
render : function (target, data, labels, color) {
if (! (target && target.getContext))