Hi:
perl -e 'print "hello world!\n"'
A simple filter:
perl -ne 'print if /REGEX/'
Filter out blank lines (in place):
Hi:
perl -e 'print "hello world!\n"'
A simple filter:
perl -ne 'print if /REGEX/'
Filter out blank lines (in place):
A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:
$e^{i \pi} = -1$
Unfortunately, GitHub does not support inline formulas. The issue is tracked here.
#!/bin/bash | |
# Upload pic_file to Google photos/Picasa with curl; returns source image URL | |
# | |
# Usage: picasa.sh -s SCALE -a ALBUMID -t PIC_NAME -u -r pic_file | |
# -s SCALE -- scale pic_file to SCALE% (with imagemagic's convert) | |
# -a ALBUMID -- if not given upload to default album | |
# -t PIC_NAME -- picture name, if not given the same as pic_file | |
# -u -- print HTML fragment with URL to pic_file | |
# -r -- remove scaled pic_file | |
# |
Presigned URLs are useful for fine-grained access control to resources on s3.
For example, if storing larger text blocks than DynamoDB might allow with its 400KB size limits s3 is a useful option.
Ignoring various ACL methods and using presigned URLs, it's possible to create lambda functions that can generate the required upload and download URLs.
Using the default IAM roles and lambda proxy configuration of serverless, lambdas are assigned an IAM role for the application (so that a logical group of functions can share resources - e.g. for a CRUD REST API). Each function then assumes the IAM role via its own function name.
# Licensed under MIT. | |
# Copyright (2016) by Kevin van Zonneveld https://twitter.com/kvz | |
# | |
# This Makefile offers convience shortcuts into any Node.js project that utilizes npm scripts. | |
# It functions as a wrapper around the actual listed in `package.json` | |
# So instead of typing: | |
# | |
# $ npm script build:assets | |
# | |
# you could just as well type: |
// Fix Vendor Prefixes | |
var IS_CHROME = !!window.webkitRTCPeerConnection, | |
RTCPeerConnection, | |
RTCIceCandidate, | |
RTCSessionDescription; | |
if (IS_CHROME) { | |
RTCPeerConnection = webkitRTCPeerConnection; | |
RTCIceCandidate = window.RTCIceCandidate; | |
RTCSessionDescription = window.RTCSessionDescription; |
get all pods in all namespace:
kubectl get pods --all-namespaces -o jsonpath="{..image}" |\
tr -s '[[:space:]]' '\n' |\
sort |\
uniq -c
const cluster = require('cluster'); | |
const numCPUs = require('os').cpus().length; | |
if (cluster.isMaster) { | |
for (var i = 0; i < numCPUs; i++) { | |
cluster.fork(); | |
} | |
cluster.on('exit', function(deadWorker, code, signal) { | |
var worker = cluster.fork(); | |
const newPID = worker.process.pid; |
#!/bin/bash | |
sudo apt install curl -y | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
sudo usermod -aG docker $USER | |
newgrp docker | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
docker-compose --version |
#!/bin/bash | |
sudo fallocate -l 4G /swapfile | |
chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo swapon -s | |
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
cat /etc/fstab | |
sudo echo "vm.swappiness=10" >> /etc/sysctl.conf |