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
@apolloclark
apolloclark / lock_down_public_s3_buckets.md
Last active January 27, 2023 08:10
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.

@russelldavies
russelldavies / build.sh
Created November 24, 2016 16:53
AWS Lambda Weasyprint
#!/bin/sh
mkdir task
cp build_weasyprint.sh task
docker run --rm -it -v $PWD/task:/var/task \
-e LD_LIBRARY_PATH='/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib' \
lambdalinux/baseimage-amzn build_weasyprint.sh
@alediaferia
alediaferia / tiny_uploader.js
Last active November 27, 2022 01:36
A tiny snippet for reading files chunk by chunk in plain JavaScript
/*
Copyright (c) 2015-2020 Alessandro Diaferia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@alkrauss48
alkrauss48 / Dockerfile
Last active November 10, 2022 16:24
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@tmarshall
tmarshall / aws-sns-example.js
Last active October 30, 2022 06:12
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();
@landonf
landonf / pcap.go
Last active September 14, 2022 00:12
Go C ffi example
/*
* Copyright (c) 2013 Landon Fuller <landonf@mac68k.info>
* All rights reserved.
*/
/* Interface to the native pcap(3) library */
package pcap
/*
#cgo LDFLAGS: -lpcap
@yesvods
yesvods / gist:51af798dd1e7058625f4
Created August 15, 2015 11:13
Merge Arrays in one with ES6 Array spread
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
@aurawindsurfing
aurawindsurfing / cloudSettings
Last active August 31, 2022 10:45
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-07-27T19:36:28.740Z","extensionVersion":"v3.4.1"}
@nkvenom
nkvenom / recursive-render.html
Last active August 5, 2022 08:15
React Example Render Recursive Function
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recursive Component in React</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.11.0/umd/react.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.11.0/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
@lukasvan3l
lukasvan3l / blogpost_oauth_meteor_jimmy.md
Last active August 5, 2022 07:50
Any OAuth login service ever created, added to your app within 5 minutes

Adding any OAuth login to your Meteor app

tl;dr: Copy the q42:accounts-microsoft and q42:microsoft package, modify the URLs and service name and it works! Probably anyway...

When creating a commercial application with a wide target audience, you can stumble upon users wanting to login using an unknown and barely used OAuth service. And why deny your users this when you can easily create a login service package?

With only about 400 million active users and only 2nd place as world most valuable brand it makes sense that no developer has created an implementation to log in with your Microsoft account. But believe it or not, some people like logging in with their Microsoft Account. And so, by building on the the default meteor google and [accounts-google](https://atmospherejs.com/me