matthew / create-gist
0 likes
0 forks
1 files
Last active
Simple script for creating a gist on an OpenGist installation
| 1 | #!/bin/bash |
| 2 | # Create a gist from the current directory |
| 3 | # |
| 4 | # Creates a gist on an OpenGist instance from the current directory. |
| 5 | # It will take care of initializing the git repo, committing all files, and |
| 6 | # pushing to the configured endpoint. On completion, it will update the remote |
| 7 | # URL to the created gist. |
| 8 | # |
| 9 | # The script requires that you create the file $HOME/.config/create-gist/url, |
| 10 | # and it should have the endpoint to an OpenGist creation URL (e.g. |
matthew / Yubikey all the things
0 likes
0 forks
1 files
Last active
Notes from my journey to getting Yubikey to authenticate everything on my system.
U2F for login and sudo access
I followed this guide: https://support.yubico.com/hc/en-us/articles/360016649099-Ubuntu-Linux-Login-Guide-U2F
For step 3, I only did the user-specific pamu2fcfg setup; I did not put it at the system level.
This makes the $HOME partition portable, and allows different users on the system to require U2F and/or use different keys.
Challenge-Response auth with YubiKey
When I originally purchased my key, and for four years thereafter, I used the challenge-response feature for restricting user authentication and sudo access.
matthew / Apigility Composite Adapter
0 likes
0 forks
3 files
Last active
An example of creating a composite adapter for Apigility
| 1 | <?php |
| 2 | use Zend\Http\Request; |
| 3 | use Zend\Http\Response;; |
| 4 | use ZF\MvcAuth\Authentication\AdapterInterface; |
| 5 | use ZF\MvcAuth\Identity\IdentityInterface; |
| 6 | use ZF\MvcAuth\MvcAuthEvent; |
| 7 | |
| 8 | class CompositeAdapter implements AdapterInterface |
| 9 | { |
| 10 | private $adapters = []; |
matthew / zend-eventmanager short-circuiting listener
0 likes
0 forks
1 files
Last active
Example of a short-circuiting event listener in Zend Framework
| 1 | <?php |
| 2 | |
| 3 | // In a module class somewhere... |
| 4 | use Zend\EventManager\LazyListener; |
| 5 | use Zend\Mvc\MvcEvent; |
| 6 | |
| 7 | class Module |
| 8 | { |
| 9 | public function onBootstrap(MvcEvent $e) |
| 10 | { |
matthew / remove path prefix
0 likes
0 forks
2 files
Last active
Details how to remove a path prefix within PSR-15 middleware
| 1 | <?php |
| 2 | |
| 3 | use Interop\Http\ServerMiddleware\DelegateInterface; |
| 4 | use Interop\Http\ServerMiddleware\MiddlewareInterface; |
| 5 | use Psr\Http\Message\ServerRequestInterface; |
| 6 | |
| 7 | class RemoveDevPrefixMiddleware implements MiddlewareInterface |
| 8 | { |
| 9 | private $prefix; |
matthew / Stratigility Microframework
0 likes
0 forks
2 files
Last active
An example of how you can write a simple one script framework for a website using PSR-15.
| 1 | { |
| 2 | "require": { |
| 3 | "laminas/laminas-stratigility": "^3.2", |
| 4 | "mezzio/mezzio-fastroute": "^3.0", |
| 5 | "laminas/laminas-diactoros": "^2.3", |
| 6 | "laminas/laminas-httphandlerrunner": "^1.2" |
| 7 | } |
| 8 | } |
matthew / Bash Comma Concatenation
0 likes
0 forks
1 files
Last active
Concatenate a list of arguments into a string using a comma separator
| 1 | ######################################### |
| 2 | ## Concatenate a list of arguments with commas |
| 3 | ## |
| 4 | ## Outputs: |
| 5 | ## Outputs all arguments as a single string, concatenated with commas |
| 6 | ######################################### |
| 7 | concatenate_with_commas() { |
| 8 | local concatenated="" |
| 9 | local string |
matthew / Launch or raise Logseq
0 likes
0 forks
1 files
Last active
Simple bash script to launch or raise Logseq and position it on the right side of the screen
| 1 | #!/bin/bash |
| 2 | # Launch Logseq and/or raise it. |
| 3 | # |
| 4 | # In all cases, it raises it on the current workspace, and positions it on the |
| 5 | # right half of the screen. Change the logic in get_width(), get_height(), and |
| 6 | # get_geometry() to change positioning and size. |
| 7 | # |
| 8 | # I bind this to <Super><Ctrl>-l, which allows me to launch it at any time. |
| 9 | |
| 10 | get_width() { |
Newer
Older