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
#!/bin/sh | |
table="<table-name>" | |
region="<table-region>" | |
primary_keys="first_key" | |
file_target="scan-results.log" | |
aws dynamodb scan \ | |
--table-name $table \ |
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
statusMessages = { | |
0: "Status is pending", | |
1: "Status is active", | |
2: "Status is cancelled", | |
"default": "Status is unknown" | |
} | |
def print_status_message(status) : | |
if status in statusMessages: | |
print(statusMessages[status]) |
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
#!/bin/bash | |
yt_link_to_media=`youtube-dl -g -f best $1` | |
/Applications/VLC.app/Contents/MacOS/VLC \ | |
--no-video-title-show \ | |
-I macosx \ | |
--video-on-top \ | |
$yt_link_to_media |
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
#!/bin/bash | |
yt_link_to_media=`youtube-dl -g -f bestaudio $1` | |
/Applications/VLC.app/Contents/MacOS/VLC --intf ncurses $yt_link_to_media | |
# use: ./stream-cli.sh https://www.youtube.com/playlist?list=PLB40FF393ACBEA4A1 |
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
$("#hello").removeClass (function (index, css) { | |
return (css.match (/\bcolor-\S+/g) || []).join(' '); | |
}); |
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
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. | |
# Will include all hosts the playbook is run on. | |
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html | |
- name: "Build hosts file" | |
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present | |
when: hostvars[item].ansible_default_ipv4.address is defined | |
with_items: groups['all'] |
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
{ | |
"title": "Bel Ami", | |
"author": "Guy de Maupassant", | |
"description": "La Belle Époque. Georges Duroy se retrouve à Paris sans argent en quête d'ascension sociale. Un soir, il rencontre Forestier un ancien camarade de régiment qui va lui proposer un poste de journaliste à la Vie Française. Il fait alors la connaissance de Clotilde de Marelle, la cousine de Madeleine Forestier, qui va lui faire découvrir une éducation sentimentale très libre. Sa beauté et son charme lui ouvrent le c ur des autres femmes qu'il côtoie et peu à peu il occupe des postes plus importants au journal. Tout le monde adopte le surnom \" Bel Ami \" donné par Laurine, la fille de Clotilde.À la mort de son ami Forestier, il épouse sa femme Madeleine et devient aussi l'amant de Madame Walter, l'épouse de son patron. Pour parfaire son ascension, il parvient à contraindre Madeleine au divorce après un constat d'adultère et épouse Suzanne, la fille de Madame Walter, enrichie par des spéculations boursières. Il finira riche, célèbre, député |
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
# Convert .mov to .gif | |
ffmpeg -i movie.mov -pix_fmt rgb24 movie-export.gif | |
# Convert .mov to .gif with acceleration : 0.3 * PTS ( Presentation Time Stamp - https://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts) | |
# From: https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video | |
ffmpeg -i trello-use-template.mov -filter:v "setpts=0.3*PTS" -pix_fmt rgb24 trello-use-template.gif |
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
# post_loc.txt contains the json you want to post | |
# -p means to POST it | |
# -H adds an Auth header (could be Basic or Token) | |
# -T sets the Content-Type | |
# -c is concurrent clients | |
# -n is the number of requests to run in the test | |
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/ |
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 slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
NewerOlder