jq is useful to slice, filter, map and transform structured json data.
brew install jq
#!/usr/bin/expect | |
set timeout 20 | |
spawn telnet $env(POP3_SERVER) $env(POP3_PORT) | |
expect +OK; send "USER $env(POP3_USER)\r" | |
expect +OK; send "PASS $env(POP3_PASS)\r" | |
expect +OK; send "STAT\r" | |
set x 1 | |
while { $x <= 10000 } { | |
expect +OK { |
#!/usr/bin/python | |
import os | |
import sys | |
import boto3 | |
# get an access token, local (from) directory, and S3 (to) directory | |
# from the command-line | |
local_directory, bucket, destination = sys.argv[1:4] |
#!/bin/bash | |
bucket=$1 | |
set -e | |
echo "Removing all versions from $bucket" | |
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'` | |
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'` |
Create a new repository, or reuse an existing one.
Generate a new SSH key:
ssh-keygen -t rsa -C "[email protected]"
Copy the contents of the file ~/.ssh/id_rsa.pub
to your SSH keys in your GitHub account settings (https://github.com/settings/keys).
Test SSH key:
Add-Type -AssemblyName System.Windows.Forms | |
while ($true) | |
{ | |
$Pos = [System.Windows.Forms.Cursor]::Position | |
$x = ($pos.X % 500) + 1 | |
$y = ($pos.Y % 500) + 1 | |
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y) | |
Start-Sleep -Seconds 10 | |
} |
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
- name: ensure github.com is a known host | |
lineinfile: | |
dest: /root/.ssh/known_hosts | |
create: yes | |
state: present | |
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}" | |
regexp: "^github\\.com" |
1.json
contains data retrieved from the Instagram API. data
is an array of media matching the query posted to Instagram's REST API, in a JSON array..data[]
loops over each media object in the JSON file, letting us process each element|
works like a regular *nix pipe, taking the output of the previous operator and passing it on to the next one.select()
filters through objects depending on the rule passed to it..tags[]
returns an array of tags for each media. contains()
returns true if the current object passed to it contains the string passed as a parameter. .tags[] | contains("100happydays")
iterates over all the tags associated with the media object and returns true if the current tag matches the string 100happydays
..select( .tags[] | contains("100happydays") )
filters all media objects that contain the tag 100happydays
.images.standard_resolution.url
nowvar isoCountries = { | |
'AF' : 'Afghanistan', | |
'AX' : 'Aland Islands', | |
'AL' : 'Albania', | |
'DZ' : 'Algeria', | |
'AS' : 'American Samoa', | |
'AD' : 'Andorra', | |
'AO' : 'Angola', | |
'AI' : 'Anguilla', | |
'AQ' : 'Antarctica', |