Skip to content

Instantly share code, notes, and snippets.

jimmycliff obonyo obonyojimmy

  • Kenya
Block or report user

Report or block obonyojimmy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robzhu
robzhu / client.js
Created Jan 4, 2019
WebSocket client.js
View client.js
const WebSocket = require('ws');
const readline = require('readline');
const url = process.argv[2];
const ws = new WebSocket(url);
ws.on('open', () => console.log('connected'));
ws.on('message', data => console.log(`From server: ${data}`));
ws.on('close', () => {
console.log('disconnected');
@obonyojimmy
obonyojimmy / aws_mongo.sh
Created Nov 20, 2018 — forked from wizact/aws_mongo.sh
Preparing and running an aws instance for Mongo
View aws_mongo.sh
#!/bin/bash
set -e
install_mongo() {
sudo yum -y update
echo "[MongoDB]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
@aurawindsurfing
aurawindsurfing / cloudSettings
Last active Feb 20, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-07-27T19:36:28.740Z","extensionVersion":"v3.4.1"}
View 16.3-blogpost-signatures.js
class Example extends React.Component<
Props,
State,
Snapshot
> {
static getDerivedStateFromProps(
nextProps: Props,
prevState: State
): $Shape<State> | null {
// ...
@gssbzn
gssbzn / yarm.config
Last active Oct 30, 2018
Elastic Beanstalk Rails+Webpacker extension
View yarm.config
# Copyright 2018 SwiftComply.com
commands:
01_node_install:
test: "[ `node --version` != 'v8.10.0' ]"
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -"
02_yarn_repo:
test: "[ ! -f /etc/yum.repos.d/yarn.repo ]"
command: "curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo"
03_yarn_install:
test: "[ ! -x /usr/bin/yarn ]"
@obonyojimmy
obonyojimmy / recursive-render.html
Created Mar 15, 2018 — forked from nkvenom/recursive-render.html
React Example Render Recursive Function
View recursive-render.html
<!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>
@apolloclark
apolloclark / lock_down_public_s3_buckets.md
Last active Mar 2, 2020
Bash one-liner to find public facing AWS S3 buckets, and make them private
View lock_down_public_s3_buckets.md

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.

@a-h
a-h / index.js
Last active Mar 25, 2020
JSON logging in winston with a timestamp
View index.js
const winston = require('winston');
const MESSAGE = Symbol.for('message');
const jsonFormatter = (logEntry) => {
const base = { timestamp: new Date() };
const json = Object.assign(base, logEntry)
logEntry[MESSAGE] = JSON.stringify(json);
return logEntry;
}
View initial-sync-data.js
function fullSync(page = 1) {
let open = indexedDB.open("books", 1);
// Set up the database schema
open.onsuccess = evt => {
let db = open.result;
fullSyncPage(db, 1);
};
}
@nnnikolay
nnnikolay / fix-npm.config
Last active May 13, 2019
Not the final AWS Elastic Beanstalk deployment for NodeJS. Why not the final? some parts are missing or not tested, like configuration changes. Currently it has been tested for application deployment only.
View fix-npm.config
files:
"/opt/elasticbeanstalk/env.vars":
mode: "000775"
owner: root
group: users
content: |
# enable extra logs
set -xe
# Defines variables for use by the other scripts below.
You can’t perform that action at this time.