A Pen by Kurt Aadnøy on CodePen.
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
#!/usr/bin/ruby | |
FILEPATH = ARGV[0] | |
OUTPUT_DIR = ARGV[1] | |
raise "Usage: ipadencode.rb FILEPATH OUTPUT_DIR" if FILEPATH.nil? || OUTPUT_DIR.nil? | |
raise "First argument must be a video file" unless File.exist?(FILEPATH) | |
raise "Second argument must be a directory" unless File.directory?(OUTPUT_DIR) | |
OUTPUT_FILE = File.basename(FILEPATH).gsub(/.[a-z0-9]{3,4}$/i, ".mp4") |
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
export SSH_AUTH_SOCK=/tmp/.ssh-socket | |
ssh-add -l 2>&1 > /dev/null | |
if [ $? = 2 ]; then | |
# Exit status 2 means we could not add to agent | |
ssh-agent -s -a $SSH_AUTH_SOCK > /tmp/.ssh-script | |
./tmp/.ssh-script | |
echo $SSH_AGENT_PID > /tmp/.ssh-agent-pid | |
fi |
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
function getPages(pageCount, current, padding, boundaryPadding) { | |
var start, end, pages; | |
start = current - padding; | |
end = current + padding; | |
if (start < 0) { | |
end += Math.abs(start) + 1; | |
} | |
if (end > pageCount) { |
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
/etc/postfix/main.cf: | |
# Use gmail as relayhost | |
relayhost = [smtp.gmail.com]:587 | |
# Map outbound users from local [email protected] to real mail users | |
smtp_generic_maps = hash:/etc/postfix/generic | |
# Configure authentication for gmail's TLS requirements | |
smtp_tls_loglevel=1 | |
smtp_tls_security_level=encrypt |
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
var fs = require('fs'), | |
sizeOf = require('image-size'); | |
function usage() { | |
console.log('usage: node img-to-svg.js {input}'); | |
process.exit(1); | |
} | |
function template(data) { | |
return '<svg xmlns="http://www.w3.org/2000/svg" \n' + |
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
svn() { | |
case "$1" in | |
"log") | |
`which svn` log $2 | perl -l40pe 's/^-+/\n/'| less | |
;; | |
"diff") | |
`which svn` diff $2 | vim -R - | |
;; | |
"st" | "status") | |
`which svn` status $2 | grep '^\s*[\?MDRCIA!~]' |
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
For development it may be useful to be able to replay TCP traffic (e.g. HTTP). The dump can be created using WireShark or tcpdump: | |
$ tcpdump -s 0 port http -i en0 -w dump.pcap | |
To generate data files that can be replayed through netcat we use tcptrace: | |
$ tcptrace -e input.pcapng | |
Finally replay the HTTP traffic using netcat to host 192.168.1.1 port 80 | |
$ cat a2b_contents.dat | nc -v 192.168.1.1 80 | |
If you need to replay the raw network traffic, we need to do some massaging using tcpprep and tcprewrite before using tcpreplay to replay the raw packages. Note that due to limitation of tcprewrite this will not replay any traffic to the network: http://tcpreplay.synfin.net/wiki/FAQ#Doestcpreplaysupportsendingtraffictoaserver. |
Follow these steps to remove all archives from an AWS vault. After this is finished, you will be able to delete the vault itself through the browser console.
This will create a job that collects required information about the vault.
$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME