Skip to content

Instantly share code, notes, and snippets.

View jjbubudi's full-sized avatar
😀
Learning

Jimmy Au jjbubudi

😀
Learning
  • Vancouver, Canada
View GitHub Profile
Nfs_core_param {
Enable_NFS_Stats = false;
Enable_NLM = false;
Protocols = "4";
}
Nfs_krb5 {
Active_krb5 = false;
}
@jjbubudi
jjbubudi / p2.ts
Last active February 17, 2019 05:05
p2.ts
import { Int64 } from './compat/long';
export type Double = number;
export type Float = number;
export type Int32 = number;
export type Int64 = Long;
export type Uint32 = number;
export type Uint64 = Long;
export type Sint32 = number;
export type Sint64 = Long;
@jjbubudi
jjbubudi / pbench.ts
Last active February 4, 2019 06:26
pbench.ts
import * as Benchmark from 'benchmark';
import { protobufSchema, int32Field, booleanField, stringField, repeated, uint32Field } from './protobus';
const InnerInner = protobufSchema({
int64: int32Field(1),
enum: uint32Field(2),
sint32: int32Field(3),
});
const Outer = protobufSchema({
@jjbubudi
jjbubudi / p.ts
Last active February 4, 2019 06:26
type double = number;
type float = number;
type int32 = number;
type int64 = number;
type uint32 = number;
type uint64 = number;
type sint32 = number;
type sint64 = number;
type fixed32 = number;
type fixed64 = number;
@jjbubudi
jjbubudi / long.ts
Last active January 26, 2019 02:11
const DIGITS = [
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
];
const TWO_TO_32 = 0x100000000;
const MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
export class UInt64 {
readonly low: number;
function provideToExport(file, api, options) {
const j = api.jscodeshift;
const root = j(file.source);
return root
.find(j.ExpressionStatement, {
expression: {
type: "CallExpression",
callee: {
object: {
name: "goog"
var l = l || {}, m = this;
function n(a) {
return "string" == typeof a;
}
function p(a, b) {
a = a.split(".");
b = b || m;
for (var c = 0; c < a.length; c++) {
if (b = b[a[c]], null == b) {
return null;
@jjbubudi
jjbubudi / TypedDictionary.swift
Created September 6, 2016 21:25
Typed Dictionary in Swift
public struct Key<T> {
let id: String
private let type: T.Type = T.self
}
extension Key: Hashable {
public var hashValue: Int {
get {
return self.id.hashValue ^ "\(self.type)".hashValue
}
#cloud-config
coreos:
etcd2:
discovery: https://discovery.etcd.io/<token>
advertise-client-urls: http://$private_ipv4:2379, http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
listen-client-urls: http://0.0.0.0:2379, http://0.0.0.0:4001
listen-peer-urls: http://$private_ipv4:2380, http://$private_ipv4:7001
fleet:
DELIMITER ;;
DROP FUNCTION IF EXISTS shard_nextval;;
CREATE FUNCTION shard_nextval() RETURNS BIGINT
BEGIN
INSERT INTO shard_seq VALUES (NULL);
SET @R_ObjectId_val = LAST_INSERT_ID();
DELETE FROM shard_seq;
RETURN @R_ObjectId_val;
END;;