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
# Staying on branch with name old_branch | |
git branch -m new_branch # Rename locally | |
git push origin :old_branch # Delete old branch | |
git push --set-upstream origin new_branch # Push, update local branch to track new remote branch |
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
1. => | |
#!/bin/bash | |
for i in `aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name ASGName | grep -i instanceid | awk '{ print $2}' | cut -d',' -f1| sed -e 's/"//g'` | |
do | |
aws ec2 describe-instances --instance-ids $i | grep -i PrivateIpAddress | awk '{ print $2 }' | head -1 | cut -d"," -f1 | |
done; | |
2. => | |
aws ec2 describe-instances --region us-east-1 --instance-ids \ | |
$(aws autoscaling describe-auto-scaling-instances --region us-east-1 --output text \ |
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
#! /bin/bash | |
# The Purpose of this Script is to batch convert and compress any video file to mp4 format | |
# | |
# WARNING: LOSSY COMPRESSION !!! | |
# Variable used: | |
# sourcedir is the directory where to be converted videos are. Converted video will be saved in the same folder | |
# usage: |
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 waitFor (time, promiseFn = () => {}) { | |
const wait = new Promise(resolve => { | |
setTimeout(resolve, time); | |
}); | |
return Promise.all([promiseFn, wait]).then( | |
args => args[0] && typeof args[0] === 'function' && args[0](), | |
() => Promise.reject('Error in waitFor') | |
); | |
} |
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 crypto = require('crypto'); | |
// larger numbers mean better security, less | |
var config = { | |
// size of the generated hash | |
hashBytes: 32, | |
// larger salt means hashed passwords are more resistant to rainbow table, but | |
// you get diminishing returns pretty fast | |
saltBytes: 16, | |
// more iterations means an attacker has to take longer to brute force an |
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
(() => { | |
try { | |
new window.ImageData(new Uint8ClampedArray([0, 0, 0, 0]), 1, 1); | |
} catch (e) { | |
function ImageDataPolyfill () { | |
let args = [...arguments], data; | |
if (args.length < 2) { | |
throw new TypeError(` | |
Failed to construct 'ImageData': 2 arguments required, but only ${args.length} present. |
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 fibonacci(){ /*...*/ } | |
var worker = new Worker( | |
"data:application/javascript;base64,"+ | |
btoa('(' + fibonacci.toString().replace(/function\s+\w+/, 'function') + ')();') | |
); | |
// More: https://plus.google.com/113853198722136596993/posts/hAtcYGc5xcw |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
const xml = ` | |
<XMLText class="yeah-attributes"> | |
regular text | |
<XMLBold> | |
bold text | |
</XMLBold> | |
another text | |
</XMLText> | |
`; |
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
<h2><span data-win-res="{textContent: 'greeting'}"></span></h2> | |
and resource file with .resjson extension within strings folder: | |
eng | |
{ | |
"greeting" : "Hello", | |
"_greeting.comment" : "A welcome greeting" | |
} |
NewerOlder