Skip to content

Instantly share code, notes, and snippets.

View armenr's full-sized avatar

Armen Rostamian armenr

View GitHub Profile
@armenr
armenr / mysql_buffer_saver_restart_reload.sh
Last active November 3, 2016 07:21
Restart MySQL with buffer pool save & reload
#!/bin/bash
#
# Perform MySQL 5.6+ restart with buffer pool save and reload
# MySQL credentials
user=
pass=
# Exit on any command failure
set -e
@armenr
armenr / Build a triangle with loops
Last active December 6, 2016 17:48
buildTriangle.js
function buildTriangle(numLines) {
var linesArray = [];
var iterations = numLines;
if (numLines < 1 ) {
return alert("Try a bigger number!")
}
for (var line = 1; line <= iterations; line++) { //start @ 1 instead of zero to avoid empty first index string
linesArray.push("#".repeat(line) + "\n");
@armenr
armenr / fizzBuzz.js
Last active December 6, 2016 20:54
fizzBuzz.js
// My Code
for (var i = 1; i <= 100; i++) {
switch (true) {
//case ((i % 3 === 0) && (i % 5 === 0)):
case (i % 15 === 0): // Use one comparison instead of two, because maths
console.log("FizzBuzz");
break;
case (i % 3 === 0):
@armenr
armenr / recursiveBubbleSort.js
Created March 28, 2017 01:23
recursiveBubbleSort.js
var bubbleSort = function(array) {
// a method to swap values @ a given pair of index positions
this.shifter = function(input, idxNext, idxElement) {
console.log('shifter engaged');
var temp = input[idxNext];
input[idxNext] = input[idxElement];
input[idxElement] = temp;
return input;
}
@armenr
armenr / promiseSample.js
Last active March 28, 2017 01:30
Simple promise
require('es6-promise');
// setTimeout(function() { console.log('TIMED OUT!') }, 300);
var promise = new Promise((fulfill, reject) => {
setTimeout(() => {
fulfill("FULFILLED!")
}, 300)
})
.then((successMessage) => {
@armenr
armenr / .gitignore
Created May 25, 2017 03:21
React Native project .gitignore
# OSX
#
.DS_Store
# Git history backup
.git.bak
# Xcode
#
build/
@armenr
armenr / recursive_bubbleSort.js
Last active November 30, 2022 09:43
Super bare-bones, naive implementation of recurisve bubble sort in JS
const myShittyArray = [55, 12, 32, 42, 17, 88, 19, 23, 71, 86, 22]
const bubbleSort = (array) => {
// a method to swap values @ a given pair of index positions
this.shifter = (input, idxNext, idxElement) => {
let temp = input[idxNext]
input[idxNext] = input[idxElement]
input[idxElement] = temp

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@armenr
armenr / kms-vault
Created August 18, 2019 19:25 — forked from hassy/kms-vault
Encrypt/decrypt files using AWS KMS
#!/usr/bin/env bash
# License: MIT - https://opensource.org/licenses/MIT
#
# Usage:
#
# Encrypt a file:
# kms-vault encrypt My-Key-Alias some-file-i-want-encrypted.txt > topsecret.asc
#
@armenr
armenr / test
Last active March 5, 2021 18:28
Embedded stack arn:aws:cloudformation:us-west-2:<STAGINGACCOUNTNUMBER>:stack/staging-WebAppStack-FrontendStackNestedStackFrontendStackNestedStackResource7A0E341B-1INCLV1YSO50I/b1e16370-7dab-11eb-9d50-061858c75b4d was not successfully created: The following resource(s) failed to create: [subzoneDelegationCrossAccountZoneDelegationRecordCrossAccountZoneDelegationRecordarubaniwebstaginggruvmeD89FF7A1, CertificateCertificateRequestorFunctionServiceRoleDefaultPolicy3C8845BC].