Skip to content

Instantly share code, notes, and snippets.

View svenvarkel's full-sized avatar

Sven Varkel svenvarkel

View GitHub Profile
@svenvarkel
svenvarkel / package_extension
Created July 2, 2014 09:20
Bamboo build step for packaging Magento extension
BUILDDIR=$1
CONNECTDIR="$BUILDDIR/public/var/connect"
PACKAGEXML="$CONNECTDIR/package.xml"
echo "Using package.xml: $PACKAGEXML"
cd $BUILDDIR/public
if [ -f "$PACKAGEXML" ];
then
./mage package $PACKAGEXML
@svenvarkel
svenvarkel / mage.php
Created July 7, 2014 08:37
Patch for missing chdir in mage.php, the Magento command line script
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
var Promise = require('bluebird');
var myType = 'mytype';
var nativePromise = new Promise(function (resolve, reject) {
sails.models[mytype].native(function (err, collection) {
if (err) {
return reject(err);
}
var pipeline = []; //some pipeline
collection.aggregate(pipeline).toArray(function (err, itemList) {
@svenvarkel
svenvarkel / usPostStreetSuffixAbbreviationMap.js
Created December 19, 2016 17:19
This gist contains US Post street suffix abbreviation map. It can be used as a part of US addresses normalization.
const suffixMap = {
"ALY": [
"ALLEE",
"ALLEY",
"ALLY",
"ALY"
],
"ANX": [
"ANEX",
"ANNEX",
@svenvarkel
svenvarkel / gist:0cb7d53139eb0258640c65bd4542ef6b
Last active March 29, 2017 17:20
Configure tag Name as hostname for New Relic
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/60_configure_newrelic_hostname.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
set -xe
export EC2_TAG_NAME=$(/opt/aws/bin/ec2-describe-tags --filter "resource-type=instance" --filter "resource-id=$(/opt/aws/bin/ec2-metadata -i | cut -d ' ' -f2)" --filter "key=Name" | cut -f5)
@svenvarkel
svenvarkel / centroid.difference.map.geojson
Last active April 6, 2017 12:10
Centroid difference
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@svenvarkel
svenvarkel / socks_on_and_off
Created January 9, 2018 11:45
Poor man's SOCKS proxy via SSH. Add the following lines to your ~/.bash_profile and then socks_on / socks_off
alias socks_on="ssh -D 8666 -C -N -f -M -S ~/.socks.socket $USER@<your_office_gateway>; networksetup -setsocksfirewallproxystate Wi-Fi on;"
alias socks_off="networksetup -setsocksfirewallproxystate Wi-Fi off; ssh -S ~/.socks.socket -O exit $USER@<your_office_gateway>;"
@svenvarkel
svenvarkel / aws_ec2_nginx_certbot_autorenew.sh
Last active January 16, 2019 23:36
This script renews the LetsEncrypt certificates in a firewalled EC2 machine inside AWS VPC
#!/usr/bin/env bash
#
# This script would help to automate renewal of LetsEncrypt TLS certificates in a Linux machine
# running nginx web server on AWS EC2.
# What it does:
# 1. it stops nginx
# 2. it opens incoming firewall ports 80 and 443 for certbot host verification
# 3. it runs certbot to renew certificates. Certbot launches a standalone HTTP server on port 80 or 443
# 4. it closes incoming firewall ports 80 and 443
# 5. it starts nginx
@svenvarkel
svenvarkel / docker-compose.yml
Last active October 7, 2019 18:57
docker-compose stack for SailsJS API with ReactJS frontend app on top of MongoDB, Redis and Nginx
version: "3.7"
services:
rabbitmq:
image: rabbitmq:3-management
environment:
RABBITMQ_DEFAULT_VHOST: "/myproject"
RABBITMQ_DEFAULT_USER: "dev"
RABBITMQ_DEFAULT_PASS: "dev"
volumes:
- type: volume
@svenvarkel
svenvarkel / Dockerfile
Created September 26, 2019 13:09
Dockerfile for SailsJS project
FROM node:10
# Set the workdir /var/www/myapp
WORKDIR /var/app/current
# Copy the package.json to workdir
COPY package.json ./
COPY package-lock.json ./
# Copy application source
COPY .sailsrc ./