Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nahidakbar's full-sized avatar

nahidakbar

  • Scentre Group
  • Sydney, Australia
View GitHub Profile
import os
import random
# INSERT INTO `dataset_album` (`pic_id`, `pic_cat_id`) VALUES
dataset_album = [
(1, 1),
(2, 1),
(3, 1),
(4, 1),
(5, 1),
var dx = 10;
var dy = 10;
var dz = 3;
var decode = function(v)
{
var z = v % dz;
var xy = (v - z) / dz;
var y = xy % dy;
var x = (xy - y) / dy;
@nahidakbar
nahidakbar / gist:4dd4e3ae2eb40954f0f6
Last active August 29, 2015 14:07
Options/Software/Singleton/singleton.js
/**
* @author Nahid Akbar
* @date 19/10/14
*/
"use strict";
var singleton = function(BaseClass, instanceParent, instanceVarName)
{
instanceParent = instanceParent !== undefined ? instanceParent : BaseClass;
instanceVarName = instanceVarName !== undefined ? instanceVarName : 'instance';
return function()
@nahidakbar
nahidakbar / gist:b3c26ddeb1f36c3f82ae
Last active August 29, 2015 14:08
ArrayBufferWriter for zip.js
/**
* @class custom Writer; zipjs one breaks in chrome for large binary files
*/
function ArrayBufferWriter(contentSize, filename)
{
var output, that = this, offset, errored;
function init(callback)
{
output = new Uint8Array(contentSize);
function Uint8ArrayListWriter(contentSize, filename)
{
var output, that = this, offset, errored;
function init(callback)
{
output = [];
offset = 0;
/**
* HDS File parser
*
* @todo add 64 bit value parsing.
*/
var loadHDS = function(binary, filename)
{
try
{
# squash git commits
# https://wincent.com/wiki/Squashing_all_Git_commits_into_a_single_commit
git update-ref -d refs/heads/master
git commit -s -m shovel
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
const wildcard = require("wildcard");
/**
* Filter an array of object by wildcard filters.
*
* @param {any[]} items list of input objects to filter
* @param {any=>string} field function that will return a string to filter given an input object
* @param {string|string[]} filters wildcard filter or filters to test. Items will be returned if any of the filters match.
* @return {any[]} list of filtered items
*/
router.get("/all", USER, async function(req, res) {
// get summary
let all = await database.getContentSummary();
// filter out by query
all = simpleFilter(all, (item: any) => item.id, req.query.id);
all = simpleFilter(all, (item: any) => item.type, req.query.type);
// filter out privates and non-configurable
all = all.filter((item: any) => {
FROM mysql:5.6
COPY dump.sql /docker-entrypoint-initdb.d
RUN chmod 755 /docker-entrypoint-initdb.d/*
ENV MYSQL_ROOT_PASSWORD test
# docker build . -t db && docker run --network=host db