Skip to content

Instantly share code, notes, and snippets.

View ejamesc's full-sized avatar

Cedric Chin ejamesc

View GitHub Profile
@ejamesc
ejamesc / aside-demo.html
Created September 11, 2018 10:52
aside-demo.html
<aside class='pullquote-r'>This is a right pullquote</aside>
<aside class='pullquote-l'>This is a left pullquote</aside>
@ejamesc
ejamesc / copy-k8s-resources-across-namespaces.sh
Created February 24, 2018 11:07 — forked from simonswine/copy-k8s-resources-across-namespaces.sh
Copying kubernetes resources accross namespaces
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create -f -
@ejamesc
ejamesc / bumpme
Last active October 12, 2017 15:33
Thu Oct 12 15:32:56 UTC 2017
tx7hb73y7xumb6j2qs02
iWMXTW+H5/ipNDxqS+En/DwV7xIaildiC1NN+kFjQYup8CoFD29XyopvJeG9UBxe
#!/usr/bin/env bash
# remove old tarsnap archives
# Copyright (c) 2015-2017 Jason W Ryan
# The MIT License (MIT) http://opensource.org/licenses/MIT
# number of archives to retain
keep=6
machine=$(hostname)
@ejamesc
ejamesc / round.py
Last active March 9, 2016 14:55
Solve rounding issues due to floating point repr in Python
from decimal import Decimal, ROUND_HALF_UP
a = round(2.675, 2)
b = Decimal(repr(2.675)).quantize(Decimal('.01'), rounding=ROUND_HALF_UP)
print a, b # 2.67, 2.68
{
init: function(elevators, floors) {
var waitingFloors = [];
var goOnIdle = function(elevator, floor) {
if (elevator.destinationDirection === "stopped") {
elevator.goToFloor(floor.floorNum());
return true;
}
return false;
Traceback (most recent call last):
File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 539, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 576, in dispatch
result = self._call_function(**self.params)
File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 312, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/Users/cedric/Projects/FloatingCube/epos/odoo-temp/openerp/http.py", line 309, in checked_call