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
Related Links: | |
https://docs.microsoft.com/en-us/windows/wsl/use-custom-distro | |
http://cloud-images.ubuntu.com/wsl/ | |
https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/ | |
https://cloudlinuxtech.com/install-linux-on-windows-10-wsl/ | |
https://docs.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions | |
To install WSL2: | |
https://docs.microsoft.com/en-us/windows/wsl/install-win10 |
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
cd $HOME | |
git clone git@github.com:pyenv/pyenv.git .pyenv | |
In your .profile, add: | |
# Initialize pyenv | |
export PYENV_ROOT="$HOME/.pyenv" | |
export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" | |
Then: | |
. .profile |
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
map $http_x_forwarded_for $backend_site { | |
~^[6] www1.zahna.com; | |
default www2.zahna.com; | |
} | |
server { | |
listen 80; | |
listen 443 ssl; | |
server_name dfas78dsf9sa.cloudfront.net; | |
access_log /dev/null; | |
location / { |
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
// https://gist.github.com/prenagha/886c44526c7e9b1bc9e904900687f6b0 | |
// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-examples.html | |
// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-permissions.html | |
'use strict'; | |
exports.handler = (event, context, callback) => { | |
let request = event.Records[0].cf.request; | |
if (request['clientIp'].match(/^[456]/)) { | |
request.headers['x-client-ip-match'] = [{'key': 'X-Client-IP-Match', 'value': 'true'}]; |
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
https://github.com/Neilpang/acme.sh.git | |
cd /var/www/acme.sh | |
./acme.sh --issue --standalone --home /var/www/ssl --cert-home /var/www/ssl --httpport 8080 -d www.zahna.com -d zahna.com | |
./acme.sh --renew --standalone --home /var/www/ssl --cert-home /var/www/ssl --httpport 8080 -d www.zahna.com -d zahna.com |
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
def alphanum_key(s): | |
'''http://nedbatchelder.com/blog/200712/human_sorting.html''' | |
tryint = lambda s: int(s) if s.isdigit() else s | |
return [ tryint(c) for c in re.split('(\d+)', s) ] | |
alist.sort(key=alphanum_key) |
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
put module code in a git repo, push to github | |
pip install -e /path/to/module/code | |
pip install -e git+https://github.com/<project.git>#egg=master <-- installs to $HOME/src/master for further developing | |
pip install git+https://github.com/<project.git>#egg=master <-- pip installs from a git repo, rather than pypi | |
register a username at both http://test.pypi.org and http://pypi.org. | |
Setup ~/.pypirc file: | |
```[distutils] |
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
location /health.pgrep { | |
default_type text/plain; | |
access_log off; | |
content_by_lua ' | |
local io = require "io" | |
if (ngx.var.arg_q ~= nil and ngx.var.arg_q ~= "") then | |
-- Note: Testing this over 127.0.0.1 will always succeed. | |
local arg_q = ngx.var.arg_q:gsub("[;&|/\\\\ ]", "") | |
local c = assert(io.popen("/usr/bin/pgrep -f "..arg_q)) |
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
In the page somewhere: | |
<script type="text/javascript" defer> | |
var gcRender = function() { | |
var sitekey, gcs, i, rcks, len; | |
sitekey = ''; | |
// Render all .g-recaptcha's on the page | |
gcs = document.getElementsByClassName('g-recaptcha'); | |
len = gcs.length; | |
for (i = 0; i < len; i++) { |
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
https://help.github.com/articles/syncing-a-fork/ | |
http://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository | |
git remote add upstream https://github.com/whoever/whatever.git | |
git fetch upstream | |
git checkout master | |
git rebase upstream/master -or- git merge upstream/master | |
<resolve conflicts> | |
git add <files> | |
git rebase --continue |
NewerOlder