Skip to content

Instantly share code, notes, and snippets.

View hasantayyar's full-sized avatar
⌨️
AFK

Hasan Tayyar Beşik hasantayyar

⌨️
AFK
View GitHub Profile
@hasantayyar
hasantayyar / README.md
Created August 17, 2012 08:53 — forked from scttnlsn/README.md
Pub/sub with MongoDB and Node.js

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
@hasantayyar
hasantayyar / proxy.coffee
Created November 19, 2018 10:12 — forked from kn0ll/proxy.coffee
a simple nodejs request proxy as connect middleware. developed as a cross domain ajax proxy.
###
a small connect middleware proxy for cross domain ajax
@path first match group will be forwarded
@host the host you want to proxy
connect_server.use proxy '^(/.+)', 'api.twitter.com'
connect_server.use proxy '^/gh(/.+)', 'api.github.com'
###
<!-- country codes (ISO 3166) and Dial codes. -->
<select name="countryCode" id="">
<option data-countryCode="GB" value="44" Selected>UK (+44)</option>
<option data-countryCode="US" value="1">USA (+1)</option>
<optgroup label="Other countries">
<option data-countryCode="DZ" value="213">Algeria (+213)</option>
<option data-countryCode="AD" value="376">Andorra (+376)</option>
<option data-countryCode="AO" value="244">Angola (+244)</option>
<option data-countryCode="AI" value="1264">Anguilla (+1264)</option>
<option data-countryCode="AG" value="1268">Antigua &amp; Barbuda (+1268)</option>

I am deploying with this IAM using Codeship and Circle CI to Elastic Beanstalk. I had a lot of trouble with this config. I talked to the aws support for about 6 hours until this worked properly, so, I guess it is worth to share.

UPDATE: In the end, I have to use the AWSElasticBeanstalkFullAccess policy. My custom policy keep breaking every week with some new added permission or some EB internal change. Anyway, the IAM I was using is below.

This works for me with CircleCI and EB Cli.

{
    "Version": "2012-10-17",
    "Statement": [
        {
@hasantayyar
hasantayyar / README.md
Created June 1, 2018 16:17 — forked from magnetikonline/README.md
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.
@hasantayyar
hasantayyar / Dockerfile
Created April 25, 2018 13:37 — forked from ju2wheels/Dockerfile
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
@hasantayyar
hasantayyar / pwnd.js
Created February 27, 2018 13:16 — forked from jgrahamc/pwnd.js
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)
@hasantayyar
hasantayyar / nginx-cors.conf
Created February 9, 2018 16:17 — forked from huandu/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}
map $cors_method $cors_max_age {
@hasantayyar
hasantayyar / nginx-cors.conf
Created February 9, 2018 16:17 — forked from huandu/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}
map $cors_method $cors_max_age {
@hasantayyar
hasantayyar / .env
Created October 11, 2017 08:18 — forked from lukewduncan/.env
AWS Lambda function for Mailchimp list subscription
API_KEY='xxxxxxxxxxxxxxxxxxx-us1'
LIST_ID=12033101ax