Skip to content

Instantly share code, notes, and snippets.

View marcelog's full-sized avatar

Marcelo Gornstein marcelog

View GitHub Profile
@marcelog
marcelog / android_emu_service_run.sh
Last active July 9, 2017 15:27
run file for running an android emulator instance with daemontools
#!/bin/bash
exec 2>&1
# These might be needed for your regular user when running it in a remote system
chmod a+rw /dev/dri/*
chmod a+rw /dev/kvm
chmod a+rw /dev/video0
exec setuidgid myemuuser envdir /etc/service/myemu/env /home/myemuuser/android-sdk-linux/tools/emulator -avd myemu
@marcelog
marcelog / android_emu_service_log_run.sh
Created July 9, 2017 15:24
log/run file for running an android emulator instance with daemontools
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/command
exec 2>&1
mkdir -p /var/log/myemu
chown -R myemuuser:myemuuser /var/log/myemu
exec envuidgid myemuuser multilog t s10485760 n5 '!tai64nlocal' /var/log/myemu
@marcelog
marcelog / pathexec_run.c
Created June 19, 2017 18:13 — forked from hirose31/pathexec_run.c
setuidgid + supplementary groups
/* Public domain. */
#include "error.h"
#include "stralloc.h"
#include "str.h"
#include "env.h"
#include "pathexec.h"
static stralloc tmp;
@marcelog
marcelog / buildspec.yml
Created April 2, 2017 15:44
Example for buildspec file for Amazon CodeBuild and Amazon CodePipeline to achieve Continuous Integration and Continuous Delivery for a ServerLess project
version: 0.1
phases:
install:
commands:
- printenv
- npm install
build:
commands:
- npm run build
@marcelog
marcelog / to_unix_eol.sh
Created March 12, 2017 22:05
Translating line endings from mac and dos to unix
#!/bin/bash
cat file.txt | tr '\r' '\n' | tr -s '\n' > file.translated.txt
@marcelog
marcelog / serverless_way_for_scheduled_events.yml
Created February 27, 2017 01:51
The right way to use scheduled events with the serverless framework and lambda
events:
- schedule:
name: 'MyEventName'
rate: cron(0 6 * * ? *)
enabled: true
input:
key: value
@marcelog
marcelog / serverless_lambda_cloudwatch_event.yml
Created February 26, 2017 16:57
An example of defining a CloudWatch scheduled event as an event for an AWS Lambda in the serverless framework by using a CloudFront template for resources
functions:
MyLambdaFunction:
role: MyLambdaRole
handler: index.handle
resources:
Resources:
MyEventName:
Type: AWS::Events::Rule
Properties:
Description: An awesome periodic event
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"events.amazonaws.com",
"lambda.amazonaws.com"
]
{
"action": "start",
"instanceId": "i-xxxxxxx"
}
#!/bin/bash
npm install
zip -r ec2_start_stop.zip *