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
use Mojolicious::Lite -signatures; | |
app->ua->max_redirects(10); | |
# Just forward the response | |
any '/*whatever' => {whatever => ''} => sub ($c) { | |
my $proxy_to = Mojo::URL->new($c->req->headers->header('X-Proxy-To') || $ENV{PROXY_TO}) or return $c->reply->not_found; | |
#my $proxy_for = Mojo::URL->new($c->req->headers->header('X-Proxy-For') || $ENV{PROXY_FOR}) or return $c->reply->not_found; | |
my $req = $c->req; | |
my $method = $req->method; |
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
bindir = /usr/bin | |
sharedir = /usr/share/my_app | |
all: | |
cpanm -L local --installdeps . | |
mkdir -p blib | |
cp -a script blib | |
cp -a lib blib | |
cp -a local/bin blib | |
cp -a local/lib/perl5/* blib/lib |
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
$ perl -Mojo -E ' | |
c(1,2,3) | |
->tap(sub{@$_ = ( | |
{properties => {release => ["QQ_2022.08.1_rc1"], commit => [1]}}, | |
{properties => {release => ["QQ_2022.08.1"]}}, | |
{properties => {release => ["QQ_2022.07.1"]}} | |
)}) | |
->map(sub{[ | |
((grep { /^QQ_2022.08.1(_rc\d+)?$/ } @{$_->{properties}->{release}})[0]||undef), | |
((grep { $_ eq "1" } @{$_->{properties}->{commit}})[0]||undef) |
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://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file | |
// application/x-ns-proxy-autoconfig | |
// https://linuxconfig.net/manuals/howto/squid-and-ldap-authentication-from-active-directory.html | |
function FindProxyForURL(url, host) { | |
if (shExpMatch(host, "xyz*") && shExpMatch(url, "*:8123*")) { | |
return "PROXY w3proxy.mozilla.org:8080"; | |
} else { | |
return "DIRECT"; | |
} | |
} |
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 gen_keys { | |
[ -z "$1" ] && { echo "Usage: $FUNCNAME passphrase"; return 1; } | |
local passphrase="$1" privatekey=$(mktemp) publickey=$(mktemp) | |
openssl genrsa -aes128 -passout pass:"$passphrase" -out $privatekey 2048 >/dev/null | |
openssl rsa -in $privatekey -passin pass:"$passphrase" -pubout -out $publickey >/dev/null | |
printf "Private Key: %s\nPublic Key: %s\n" $privatekey $publickey | |
} | |
function sign_file { | |
[ -z "$2" ] && { echo "Usage: $FUNCNAME file privatekey publickey"; return 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
{ | |
dropbox => { | |
'cpa file' => '^sdk/SDKv\d+\.\d+\+\d{8}\.\d+\.tar(\.gz)?$', | |
'cpa file' => '^tk/TK-\d+\.\d+\+\d{8}\.\d+\.tar(\.gz)?$', | |
'cpa release file' => '^rc_bundles/XX\d_\d{4}\.\d{2}(\.\d+)?_rc\d+/.*?\.tar(\.gz)?$', | |
} | |
} |
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
carmel carton Module::Build ExtUtis::MakeMaker | |
$ sudo apt install libpq-dev libssl-dev | |
$ \curl -L https://install.perlbrew.pl | bash | |
$ perlbrew use perl-5.36.0 | |
$ perlbrew install-cpanm | |
# mojo.js vscode-mojo vscode-mojo.js nodejs16 | |
$ cpanm Mojolicious Mojo::Pg Minion Mojo::SQLite Minion::Backend::SQLite Future::AsyncAwait Role::Tiny Cpanel::JSON::XS EV IO::Socket::SSL IO::Socket::Socks Net::DNS::Native Mojolicious::Plugin::Status JSON::Validator | grep ^Fetching | sed 's/Fetching \(.*\) ... OK/\1/' | |
http://www.cpan.org/authors/id/S/SR/SRI/Mojolicious-9.27.tar.gz | |
http://www.cpan.org/authors/id/S/SR/SRI/Mojo-Pg-4.27.tar.gz |
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 sloc { local author="$1" from="$2" to="$3" path="$4"; while read hash; do git diff-tree --numstat --no-commit-id $hash | grep -P '^\d+\s+\d+\s+'$path; done < <(git log --author='^('$author').*$' --perl-regexp --format='%H' $from..$to) | perl -pE 'END { say "$a\t$b" } @_=split/\s+/;$a+=$_[0]; $b+=$_[1]'; } | |
$ sloc Sebastian 18f95d36c c87e5244d4 lib | |
1 1 lib/Mojolicious.pm | |
1 1 lib/Mojo/Headers.pm | |
8 4 lib/Mojo/Asset/Memory.pm | |
1 1 lib/Mojolicious.pm | |
2 2 lib/Mojolicious.pm | |
1 1 lib/Mojolicious/resources/templates/mojo/debug.html.ep | |
1 1 lib/Mojolicious/Guides/Rendering.pod |
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://duckduckgo.com/?q=error+response+from+daemon+createcomputesystem+is+not+supported&ia=web | |
https://download.docker.com/win/static/stable/x86_64/ | |
https://blog.carlesmateo.com/2022/02/14/using-docker-in-windows-10-without-windows-desktop-with-docker-engine-and-without-wsl/ | |
https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-docker/manage-windows-dockerfile | |
https://dev.to/_nicolas_louis_/how-to-run-docker-on-windows-without-docker-desktop-hik | |
https://github.com/microsoft/dotnet-framework-docker/issues/660 | |
https://duckduckgo.com/?q=firewalld+is+not+running&ia=web | |
https://duckduckgo.com/?q=firewall-cmd+failed+to+connect+to+socket&ia=web | |
https://github.com/docker/for-linux/issues/1105 | |
https://simplernerd.com/wsl2-uncompressed/ |
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 sudo { local sudo=$(which sudo) what; sudo -v || return; whatis $1 &>/dev/null && what=$(whatis $1 | perl -pE 's/^.*?- //') || while :; do what=$(zenity --entry --title "Sudo Log" --text "What are you doing with \$($*)") && [ ${#what} -ge 5 ] && break; done; echo "Security Log: $what | sudo $*" | logger; $sudo -E $*; } |