Skip to content

Instantly share code, notes, and snippets.

View waltervargas's full-sized avatar
🎯
BioHacking(self)

Walter Vargas waltervargas

🎯
BioHacking(self)
View GitHub Profile
@waltervargas
waltervargas / package.json
Created April 21, 2016 05:21
for tutorial react-electron-webpack
{
"name": "my-electron-app",
"version": "0.1.0",
"main": "main.js",
"devDependencies": {
"babel": "^6.5.2",
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"css-loader": "^0.23.1",
"electron-packager": "^7.0.0",
@waltervargas
waltervargas / main.js
Created November 17, 2016 02:44
electron window surfi
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 350, height: 500, frame: true, transparent: false,
titleBarStyle: 'hidden-inset',
webPreferences: {
nodeIntegration: true,
webSecurity: false,
plugins: true
}
});
const AWS = require('aws-sdk');
const YAML = require('yamljs');
AWS.config.update({region: 'us-east-1'});
const ec2 = new AWS.EC2();
const mapping = {
RegionMap: {}
};
@waltervargas
waltervargas / bash_recipes.sh
Created January 21, 2017 04:48
bash recipes
# funtion to log messages to the log file
function log
{
echo "["`date +'%m/%d/%Y %H:%M:%S'`"] "$@ >> $LOGFILE
}
@waltervargas
waltervargas / amilookup.js
Created February 20, 2017 16:15
A sample AWS Lambda function that looks up the latest AMI ID for a given region and architecture.
/**
* A sample Lambda function that looks up the latest AMI ID for a given region and architecture.
**/
// Map instance architectures to an AMI name pattern
var archToAMINamePattern = {
"PV64": "amzn-ami-pv*x86_64-ebs",
"HVM64": "amzn-ami-hvm*x86_64-gp2",
"HVMG2": "amzn-ami-graphics-hvm*x86_64-ebs*"
};
@waltervargas
waltervargas / route53update.sh
Created February 26, 2017 00:47
AWS Userdata script to create/update route53 private hosted zone record for ec2 instance.
# Update route53 record
localip=$(curl -fs http://169.254.169.254/latest/meta-data/local-ipv4)
hostedzoneid=$(aws route53 list-hosted-zones-by-name --dns-name ${Env}.${AWS::Region}.aws.example.com --query 'HostedZones[0].Id' | cut -d / -f 3 | tr -d '"')
file=/tmp/record.json
cat << EOF > $file
{
"Comment": "Update the A record set",
"Changes": [
{
"Action": "UPSERT",
@waltervargas
waltervargas / plugins.groovy
Last active March 1, 2017 12:13
Jenkins Plugins Installation from Groovy Init
#!groovy
import jenkins.model.*
import java.util.logging.Logger
def log = Logger.getLogger("")
def instance = Jenkins.getInstance()
def updateCenter = instance.getUpdateCenter()
def pluginManager = instance.getPluginManager()
def plugins = "git pipeline-stage-view job-dsl github workflow-aggregator".split()
@waltervargas
waltervargas / init-seed-job-load.groovy
Created March 1, 2017 12:20
Jenkins init.groovy.d init seed-job load automatic to use with packer or ansible on AWS or any cloud
import javaposse.jobdsl.dsl.DslScriptLoader
import javaposse.jobdsl.plugin.JenkinsJobManagement
def jobDslScript = new File('/tmp/seed-job.groovy')
def workspace = new File('.')
def jobManagement = new JenkinsJobManagement(System.out, [:], workspace)
new DslScriptLoader(jobManagement).runScript(jobDslScript.text)
@waltervargas
waltervargas / webui.py
Created March 9, 2017 19:47
Python version for webui.py used by dockercoins -> https://github.com/jpetazzo/dockercoins
from flask import Flask
from flask import jsonify
from redis import Redis
import time
app = Flask(__name__, static_url_path="")
redis = Redis('redis')
@app.route('/')
def root():
@waltervargas
waltervargas / sg-self-reference.yml
Created March 16, 2017 23:24
CloudFormation SG Self-Referenced
---
Description: Create a VPC with a SG which references itself
AWSTemplateFormatVersion: '2010-09-09'
Resources:
vpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 172.16.0.0/16
EnableDnsSupport: false
EnableDnsHostnames: false