Skip to content

Instantly share code, notes, and snippets.

View VladimirCores's full-sized avatar
💭
evolve

Vladimir Minkin VladimirCores

💭
evolve
View GitHub Profile
@VladimirCores
VladimirCores / gist:72c2a19143a47a5318f41f1d9bb7a449
Created May 17, 2018 12:08
GCP - Multiple VM instances creation from console
for i in {1..3}; \
do \
gcloud compute instances create "nginxstack-$i" \
--machine-type "f1-micro" \
--tags nginxstack-tcp-443,nginxstack-tcp-80 \
--zone us-central1-f \
--image "https://www.googleapis.com/compute/v1/projects/bitnami-launchpad/global/images/bitnami-nginxstack-1-10-2-0-linux-debian-8-x86-64" \
--boot-disk-size "200" --boot-disk-type "pd-standard" \
--boot-disk-device-name "nginxstack-$i"; \
done
gcloud config list project
gcloud compute target-vpn-gateways \
create vpn-1 \
--network vpn-network-1 \
--region us-east1
gcloud compute target-vpn-gateways \
create vpn-2 \
--network vpn-network-2 \
@VladimirCores
VladimirCores / gist:5a35fe7804f131cbdf75b47c1c50039e
Created August 8, 2018 08:23
Change all files permission from current folder to not executable in git
find . -type f -exec git update-index --chmod=-x {} \;
git status
git commit -m "Changing file permissions to remove execute bit"
git push
@VladimirCores
VladimirCores / gist:5df9026ccd882799ab43523d63b6d9b3
Created August 9, 2018 16:33
Convert image to base64 on mac with OpenSSL
openssl base64 -A -in <image_path> | pbcopy
@VladimirCores
VladimirCores / meta-tags.md
Created August 10, 2018 18:57 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
0. Downalod atlassian-jira-core-X.X.X-x64.bin
1. gcloud config set compute/zone europe-west4-a
2. sudo chmod a+x atlassian-jira-core-X.X.X-x64.bin
3. sudo ./atlassian-jira-core-X.X.X-x64.bin
@VladimirCores
VladimirCores / gist:8e3ea60ae8c37c008181b4265d6ae991
Created September 29, 2019 13:09
Remove breaks from text and copy to clipboard
function copyToClipboard(text) {
var dummy = document.createElement("textarea");
// to avoid breaking orgain page when copying more words
// cant copy when adding below this code
// dummy.style.display = 'none'
document.body.appendChild(dummy);
//Be careful if you use texarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard
dummy.value = text;
dummy.select();
document.execCommand("copy");
/*
* serial executes Promises sequentially.
* @param {funcs} An array of funcs that return promises.
* @example
* const urls = ['/url1', '/url2', '/url3']
* serial(urls.map(url => () => $.ajax(url)))
* .then(console.log.bind(console))
*/
export const sequence = funcs => funcs.reduce((acc, b) => acc.then((f => x => f().then((list => Array.prototype.concat.bind(list))(x)))(b)), Promise.resolve([]))
const BRACKETS = ['{', '}', '(', ')', '[', ']']
let isValidByCount = (str) => {
let bracketPosition = 0
let bracketsAmountPerType = new Array(BRACKETS.length).fill(0)
for (let char of str) {
bracketPosition = BRACKETS.indexOf(char)
if (bracketPosition > -1) bracketsAmountPerType[bracketPosition] += 1
}
for (let i = 0; i < BRACKETS.length; i+=2)
if (bracketsAmountPerType[i] !== bracketsAmountPerType[i+1])
Add to ~/.bash_profile:
function killOnTCPPort () {
kill -QUIT $(sudo lsof -sTCP:LISTEN -i tcp:$1 -t)
}
Then source ~/.bash_profile and run