Skip to content

Instantly share code, notes, and snippets.

View obonyojimmy's full-sized avatar
💻
probably coding

jimmycliff obonyo obonyojimmy

💻
probably coding
View GitHub Profile
@obonyojimmy
obonyojimmy / aws-sns-example.js
Created March 4, 2018 03:42 — forked from victusfate/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@obonyojimmy
obonyojimmy / aws-sns-example.js
Created March 4, 2018 18:19 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@obonyojimmy
obonyojimmy / recursive-render.html
Created March 15, 2018 04:08 — forked from nkvenom/recursive-render.html
React Example Render Recursive Function
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recursive Rendering in React</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
@obonyojimmy
obonyojimmy / Dockerfile
Created April 9, 2018 01:09 — forked from toddlers/Dockerfile
using envsubst in Dockerfile
FROM ubuntu:trusty
RUN \
apt-get update \
&& apt-get -y install gettext-base \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV VALUE=foo
ENV VALUE1=boo
COPY config.txt source_config.txt
@obonyojimmy
obonyojimmy / validate_json.sh
Created April 9, 2018 02:19 — forked from kamiller/validate_json.sh
validate json with python via bash script
echo '{"foo":"bar"}' | python -m json.tool >> /dev/null && exit 0 || echo "NOT valid JSON"; exit 1
@obonyojimmy
obonyojimmy / .eslintrc.js
Created April 11, 2018 20:43 — forked from jasoet/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@obonyojimmy
obonyojimmy / script.js
Last active April 11, 2018 22:01
[WIP] Drag n' Drop File Upload with React
var D = React.DOM;
var FileInput = React.createClass({
getInitialState: function(){
return {
active: false,
target: false,
hover: false
};
},
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="output" style="min-height: 200px; white-space: pre; border: 1px solid black;"
ondragenter="document.getElementById('output').textContent = ''; event.stopPropagation(); event.preventDefault();"
@obonyojimmy
obonyojimmy / removing-empty-array-items.js
Created April 23, 2018 20:09
remove-empty-elements-from-an-array-in-javascript
// https://stackoverflow.com/a/48163228/1226748
// For removing holes, you should use
arr.filter(() => true)
// For removing hole, and, falsy (null, undefined, 0, -0, NaN, "", false, document.all) values:
arr.filter(x => x)
// For removing hole, null, and, undefined:
@obonyojimmy
obonyojimmy / lock_down_public_s3_buckets.md
Created April 25, 2018 03:01 — forked from apolloclark/lock_down_public_s3_buckets.md
Bash one-liner to find public facing AWS S3 buckets, and make them private

Command

aws s3api list-buckets --query 'Buckets[*].[Name]' --output text | xargs -I {} bash -c 'if [[ $(aws s3api get-bucket-acl --bucket {} --query '"'"'Grants[?Grantee.URI==`http://acs.amazonaws.com/groups/global/AllUsers` && Permission==`READ`]'"'"' --output text) ]]; then aws s3api put-bucket-acl --acl "private" --bucket {} ; fi'



1. List all of the user's buckets, and output the name, as text.