- Auto Sync
- When a hard drive is connected (one allowed by usbguard), run an application
- Using an /etc config file, the UUID maps to what type of content to sync
- rsync the type of content to the mount point of the hard drive
- in the background, regularly check the progress of the transfer (du -sbc /dst | tail -1 | cut -f1) / (du -sbc /src | tail -1 | cut -f1) and write the percentage to /tmp/media/mount_point
- if the size > 100, flip the division
- if rsync is not running, empty /tmp/media/mount_point
- if the media is not mounted, remove /tmp/media/mount_point
This file contains hidden or 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
| // $ rm -f xprogress.c ; vi xprogress.c ; gcc -o xprogress xprogress.c -lX11 | |
| // $ mkdir -p media ; echo 10 > media/media1.txt ; echo 20 > media/media2.txt ; ./xprogress media | |
| #include <X11/Xlib.h> | |
| #include <X11/Xutil.h> | |
| #include <X11/Xatom.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> |
This file contains hidden or 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
| # https://arminreiter.com/2022/01/create-your-own-certificate-authority-ca-using-openssl/ | |
| # https://blog.xelnor.net/firefox-systemcerts/ | |
| CANAME=${1:-MyOrg-RootCA} | |
| # optional, create a directory | |
| mkdir $CANAME | |
| cd $CANAME | |
| # generate aes encrypted private key | |
| openssl genrsa -aes256 -out $CANAME.key 4096 | |
| # create certificate, 1826 days = 5 years |
This file contains hidden or 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
| package Mojolicious::Command::start; | |
| use Mojo::Base 'Mojolicious::Command', -signatures; | |
| use Mojo::Util qw(extract_usage getopt); | |
| has description => 'Show versions of available modules'; | |
| has usage => sub { shift->extract_usage }; | |
| has perlbrew_with => sub { | |
| return undef unless $ENV{PERLBREW_ROOT} && $ENV{PERLBREW_HOME} && $ENV{PERLBREW_PERL}; |
This file contains hidden or 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
| package Mojolicious::Plugin::Flickr; | |
| use Mojo::Base 'Mojolicious::Plugin', -signatures; | |
| use Digest::SHA qw(hmac_sha1); | |
| use Mojo::Collection qw(c); | |
| use Mojo::JSON qw(j); | |
| use Mojo::Parameters; | |
| use Mojo::Util qw(b64_encode hmac_sha1_sum md5_sum url_escape); | |
| has app => undef, weak => 1; |
This file contains hidden or 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
| function cd { | |
| local _TMUX_PANE=${TMUX_PANE:-%0} | |
| HISTFILE=$HISTFILE_PREFIX-${_TMUX_PANE:1} | |
| export LC_HISTFILE=$HISTFILE | |
| if [ "$1" == -q ]; then shift; test -d "$1" || return; fi; builtin cd "$@"; echo $(pwd) > ${HISTFILE/bash_histories/pwd}; | |
| } | |
| function history-file { echo $HISTFILE; } | |
| function reload { | |
| umask 0022 | |
| readonly -p | grep -q TMOUT= || unset TMOUT |
This file contains hidden or 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
| # This demonstrates the concept for a program to only execute by a trusted caller | |
| # This demonstration uses an extremely simple algorithm, but of course the idea is only to make it more annoyng for someone to spoof the caller | |
| # as the attacker needs to know the algorithm | |
| # And of course caller and callee need to implement the exact same algorithm pair | |
| # Indeed, use RSA to make this idea more cryptographically secure | |
| $ perl a 123 # "a" single argument is a filename | |
| { | |
| "a" => { | |
| "file" => 123, # message dumped to stderr for inspection |
---
displayMode: compact
---
gantt
title Roadmap
dateFormat YYYY-MM-DD
axisFormat %b '%y
tickInterval 3month
2023 : 2023-11-01, 2023-12-31
This file contains hidden or 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
| diff --git a/examples/blog/lib/Blog.pm b/examples/blog/lib/Blog.pm | |
| index 57a2291..ebf83cb 100644 | |
| --- a/examples/blog/lib/Blog.pm | |
| +++ b/examples/blog/lib/Blog.pm | |
| @@ -30,6 +30,8 @@ sub startup { | |
| $r->get('/posts/:id/edit')->to('posts#edit')->name('edit_post'); | |
| $r->put('/posts/:id')->to('posts#update')->name('update_post'); | |
| $r->delete('/posts/:id')->to('posts#remove')->name('remove_post'); | |
| + | |
| + $r->post('/log')->to('posts#log')->name('log_post'); |
This file contains hidden or 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
| # requires libssl-dev | |
| all: | |
| gcc -c -o send_recv.o send_recv.c -Wno-psabi | |
| gcc -c -o recv.o recv.c -lcrypto | |
| gcc -o recv send_recv.o recv.o -lm -lcrypto -Wno-psabi | |
| gcc -c -o send.o send.c -Wno-psabi | |
| gcc -o send send_recv.o send.o -lm -lcrypto -Wno-psabi |