View sshb0t.service
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
# /etc/systemd/system/sshb0t.service | |
[Unit] | |
Description=Sync ssh keys | |
After=network.target | |
[Service] | |
Type=simple | |
User=mloberg | |
WorkingDirectory=/home/mloberg | |
ExecStart=/usr/local/bin/sshb0t --interval 1h --user mloberg |
View Lockout.php
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
<?php | |
declare(strict_types=1); | |
namespace App\Security; | |
use DateTimeImmutable; | |
use Generator; | |
use Predis\Client; |
View media.sh
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
#!/usr/bin/env bash | |
set -e | |
# convert and optmize jpg files to png & gif | |
# requires imagemagick (brew install imagemagick) | |
while read -r file; do | |
echo ">> resizing/converting $file" | |
name="${file%.*}" | |
convert "$file" -resize 1600 -quality 85 -strip "${name}.jpg" | |
convert "$file" -quality 85 -strip -colors 256 "${name}.png" |
View gist:467536d2b6a1eb3c92a13b804faedd78
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
### Keybase proof | |
I hereby claim: | |
* I am mloberg on github. | |
* I am mloberg (https://keybase.io/mloberg) on keybase. | |
* I have a public key ASDcFyl0kafbvzkZ9nI-2-9d5Kk5XQMLUTnjNRw5p5s_DAo | |
To claim this, I am signing this object: |
View batch.py
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
from itertools import islice, chain | |
def batch(iterable, size): | |
iterator = iter(iterable) | |
for first in iterator: | |
yield chain([first], islice(iterator, size - 1)) |
View npm.sh
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
npm () { | |
[ -n "$NODE_VERSION" ] || NODE_VERSION="latest" | |
tty= | |
tty -s && tty=--tty | |
docker run \ | |
$tty \ | |
--interactive \ | |
--rm \ | |
--user $(id -u):$(id -g) \ |
View mphp
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
#!/usr/bin/env bash | |
# | |
# Copyright (c) 2016 Matthew Loberg | |
# Distributed under the MIT License (http://opensource.org/licenses/MIT) | |
# | |
# ========================== | |
# Manage PHP (uses Homebrew) | |
# ========================== | |
# | |
# Commands: |
View comparison.php
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
<?php | |
function compareHashes($hashOne, $hashTwo) | |
{ | |
$result = 0; | |
for ($i = 0; $i < strlen($hashOne); $i++) { | |
$charOne = substr($hashOne, $i, 1); | |
$charTwo = substr($hashTwo, $i, 1); | |
$intOne = base_convert($charOne, 16, 10); |
View FormCollectionView.js
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
/** | |
* @fileOverview Form collection handler | |
* | |
* @author Matthew Loberg | |
*/ | |
define(function(require, module, exports) { | |
'use strict'; | |
var $ = require('jquery'); |
View nginx.conf.erb
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
<%# modules/common/templates/nginx.conf.erb %> | |
# Example template for PHP-FPM based projects | |
# | |
# The template which nginx uses within a boxen::project can be overridden | |
# to a specific template such as this one. | |
# | |
# You will likely need to change both the root and SCRIPT_FILENAME parameters below | |
# to match your setup | |
# | |
server { |
NewerOlder