Skip to content

Instantly share code, notes, and snippets.

View liuce's full-sized avatar
🏠
Working from home

liuce liuce

🏠
Working from home
View GitHub Profile
@liuce
liuce / Jenkinsfile
Created August 24, 2022 16:07 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@liuce
liuce / docker-cleanup-resources.md
Created October 8, 2017 09:39 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@liuce
liuce / docker-compose.yml
Created September 27, 2017 06:21 — forked from garycrawford/docker-compose.yml
MongoDB Replica Set docker-compose.yml
primary:
image: mongo:3.0
volumes:
- ./p:/data
ports:
- "27017:27017"
# Our current version of docker-compose doesn't allow extra_hosts which would be the best way
# to add curcular dependency container links in this case. We cant upgrade docker-compose
# without upgrading docker to 1.7, and we can't do that without upgrading the kernel on our
# CentOS VM's. As such we are using the hostname hask below to allow primary and secondary
@liuce
liuce / gist:ac803e2206d993786636ee1da0f15f5c
Created April 12, 2017 14:02 — forked from rpgreen/gist:c127aa4ebbcaa9026be7
Swagger file demonstrating two ways to achieve HTTP redirects using API Gateway and Lambda
---
swagger: "2.0"
basePath: "/test"
schemes:
- "https"
paths:
/lambdaredirect-default:
get:
produces:
- "application/json"
@liuce
liuce / User.ts
Created November 16, 2016 03:08 — forked from masahirompp/User.ts
mongoose + typescript
/// <reference path="../tsd/tsd.d.ts" />
import mongoose = require('mongoose');
import passport = require('passport');
interface IUser extends mongoose.Document {
provider: string;
id: string;
authorId: string;
displayName: string;
@liuce
liuce / nginx.conf
Created August 15, 2016 17:10 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@liuce
liuce / OS X - installing Ansible via `pip install`
Created November 29, 2015 16:13 — forked from dburrows/OS X - installing Ansible via `pip install`
Reliably installing Ansible on OS X Mavericks
// brew install ansible didn't work properly,
// even tried brew install python but no joy
// so use pip on standard python install
sudo pip install ansible
// if you get errors try this
// from https://github.com/ansible/ansible/issues/7146
When you get to the step 'sudo pip install ansible', do this instead:
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
mongoose = require('mongoose');
var GridStore = mongoose.mongo.GridStore,
Grid = mongoose.mongo.Grid,
ObjectID = mongoose.mongo.BSONPure.ObjectID;
exports.getGridFile = function(id, fn) {
var db = mongoose.connection.db,
id = new ObjectID(id),