Skip to content

Instantly share code, notes, and snippets.

@Carolusian
Carolusian / s.bash
Last active August 29, 2015 14:22 — forked from dapangmao/s.bash
sudo openvpn --config *.opvn
apt-get update
apt-get install vim
wget http://d3kbcqa49mib13.cloudfront.net/spark-1.3.0-bin-hadoop2.4.tgz | tar zxf
hadoop fs -mkdir /spark
hadoop fs -put spark-1.3.0-bin-hadoop2.4.tgz /spark
hadoop fs -du -h /spark
cp spark-env.sh.template spark-env.sh
@Carolusian
Carolusian / i18n-express-hbs-app.js
Last active August 29, 2015 14:26 — forked from mashpie/i18n-express-hbs-app.js
express + i18n-node + handlebars and avoid concurrency issues
// require modules
var express = require('express'),
i18n = require('i18n'),
hbs = require('hbs'),
app = module.exports = express();
i18n.configure({
locales: ['en', 'fr'],
cookie: 'locale',
directory: "" + __dirname + "/locales"
@Carolusian
Carolusian / keystone.js
Last active August 29, 2015 14:26 — forked from JedWatson/keystone.js
Example of how to integrate node-i18n with a KeystoneJS app (using yo keystone generated site as a basis) - see https://github.com/mashpie/i18n-node for more docs.
// Simulate config options from your production environment by
// customising the .env file in your project's root folder.
require('dotenv')().load();
// Require keystone and i18n
var keystone = require('keystone'),
i18n= require('i18n');
// Initialise Keystone with your project's configuration.
// See http://keystonejs.com/guide/config for available options
@Carolusian
Carolusian / KeystoneApiExample.md
Created September 23, 2015 12:20 — forked from JedWatson/KeystoneApiExample.md
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@Carolusian
Carolusian / how-to-set-up-stress-free-ssl-on-os-x.md
Created December 27, 2015 10:36 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@Carolusian
Carolusian / docker-shadowsocks-go.md
Created March 12, 2016 15:03 — forked from luw2007/docker-shadowsocks-go.md
如何使用docker科学上网

##问: 我怎么用docker 部署ss server

##答:

  1. 购买vps: 这个途径比较多。 网上一搜一大把。
  2. vps上安装docker: 方法很多, 比如ubuntu上可以使用sudo apt-get install docker.io 我采用的vps服务提供商提供的docker镜像。
  3. 使用docker 安装ss-server:
@Carolusian
Carolusian / vm-resize-hard-disk.md
Created March 26, 2016 12:44 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@Carolusian
Carolusian / README.md
Created March 30, 2016 10:47 — 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.
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@Carolusian
Carolusian / AWS Swarm cluster.md
Created December 24, 2016 18:09 — forked from ghoranyi/AWS Swarm cluster.md
Create a Docker 1.12 Swarm cluster on AWS

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.

Prerequisites

You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.