Skip to content

Instantly share code, notes, and snippets.

View r115's full-sized avatar
:octocat:
🇰🇪

Bernard r115

:octocat:
🇰🇪
View GitHub Profile
@r115
r115 / awsParamToEnv.sh
Last active March 21, 2024 15:51
Aws Parameter Store To System Environment Variable
aws ssm get-parameters-by-path \
--path /apps/prod --region us-east-1 \
| jq '.Parameters[] |.Name, .Value' \
| xargs -n2 -d'\n' | tr -s '[:blank:]' '=' \
| sed 's/"//g' \
| sed 's@.*/@@' \
| sed 's/^/export /' > \
| sudo tee /etc/profile.d/my_envs.sh
@r115
r115 / aws.upload-folder-to-s3.js
Created May 13, 2020 12:47 — forked from jlouros/aws.upload-folder-to-s3.js
Upload folder to S3 (Node.JS)
const AWS = require("aws-sdk"); // from AWS SDK
const fs = require("fs"); // from node.js
const path = require("path"); // from node.js
// configuration
const config = {
s3BucketName: 'your.s3.bucket.name',
folderPath: '../dist' // path relative script's location
};
@r115
r115 / gist:6821a886ab9b12996b8c35a6d0564a1a
Created November 15, 2019 04:02 — forked from lsauer/gist:2757250
JavaScript : within a string, count the number of occurances of a character / character counting and string-position
//www.lsauer.com 2012
//Answer to:
//http://stackoverflow.com/questions/881085/count-the-number-of-occurances-of-a-character-in-a-string-in-javascript/10671743#10671743
//There are at least four ways. The best option, which should also be the fastest -owing to the native RegEx engine -, is placed at the top. //jsperf.com is currently down, otherwise I would provide you with performance statistics.
#1.
("this is foo bar".match(/o/g)||[]).length
//>2
#2.
"this is foo bar".split("o").length-1
@r115
r115 / server.badbots
Created September 18, 2019 14:05 — forked from hans2103/server.badbots
NGINX to block bad bots. (add Twenga|TwengaBot if you want to exclude them too)
if ($http_user_agent ~* (360Spider|80legs.com|Abonti|AcoonBot|Acunetix|adbeat_bot|AddThis.com|adidxbot|ADmantX|AhrefsBot|AngloINFO|Antelope|Applebot|BaiduSpider|BeetleBot|billigerbot|binlar|bitlybot|BlackWidow|BLP_bbot|BoardReader|Bolt\ 0|BOT\ for\ JCE|Bot\ mailto\:craftbot@yahoo\.com|casper|CazoodleBot|CCBot|checkprivacy|ChinaClaw|chromeframe|Clerkbot|Cliqzbot|clshttp|CommonCrawler|comodo|CPython|crawler4j|Crawlera|CRAZYWEBCRAWLER|Curious|Curl|Custo|CWS_proxy|Default\ Browser\ 0|diavol|DigExt|Digincore|DIIbot|discobot|DISCo|DoCoMo|DotBot|Download\ Demon|DTS.Agent|EasouSpider|eCatch|ecxi|EirGrabber|Elmer|EmailCollector|EmailSiphon|EmailWolf|Exabot|ExaleadCloudView|ExpertSearchSpider|ExpertSearch|Express\ WebPictures|ExtractorPro|extract|EyeNetIE|Ezooms|F2S|FastSeek|feedfinder|FeedlyBot|FHscan|finbot|Flamingo_SearchEngine|FlappyBot|FlashGet|flicky|Flipboard|g00g1e|Genieo|genieo|GetRight|GetWeb\!|GigablastOpenSource|GozaikBot|Go\!Zilla|Go\-Ahead\-Got\-It|GrabNet|grab|Grafula|GrapeshotCrawler|GTB5|GT\:\:WWW|Guzz
killall ssh-agent; eval `ssh-agent`

Keybase proof

I hereby claim:

  • I am nandwabee on github.
  • I am nandwabee (https://keybase.io/nandwabee) on keybase.
  • I have a public key ASB4MUUI6-1uhMUVABCN5kBFoGkKmBp8ad8HaigIzrCZEQo

To claim this, I am signing this object:

@r115
r115 / ionic_publish_android_app.md
Created March 4, 2016 05:31 — forked from leommoore/ionic_publish_android_app.md
Ionic Publish Android App

#Ionic Publish Android App

This is the process to publish an ionic android app.

  1. Make sure you set/increment the version number in config.xml ie 0.0.3.

  2. Make sure the android platform has been added

@r115
r115 / sampleRelease.sh
Created January 14, 2016 10:11
Sign and release a cordova app on ubuntu
#Step 1
keytool -genkey -v -keystore my_app.keystore -alias my_app_key -keyalg RSA -keysize 2048 -validity 10000
#Step 2
cordova build --release android
#Step 3
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my_app.keystore platforms/android/build/outputs/apk/android-release-unsigned.apk my_app_key
#Step 4
@r115
r115 / sampleSQL.sql
Created January 9, 2016 14:41
MySQL scripts
#Create a UTF8 schema in MySQL
CREATE SCHEMA `my_database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
# This file has been modified by Eli Dickinson to update detection rules and to
# send a Vary header downstream. It has also been updated to
# work with newer versions of Varnish.
#
# A simple mobile device detection implementation in VCL
# http://fangel.github.com/mobile-detection-varnish-drupal
#
# The file is based upon initial work done by Audun Ytterdal, which can be