This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Uint8ArrayListWriter(contentSize, filename) | |
{ | |
var output, that = this, offset, errored; | |
function init(callback) | |
{ | |
output = []; | |
offset = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* HDS File parser | |
* | |
* @todo add 64 bit value parsing. | |
*/ | |
var loadHDS = function(binary, filename) | |
{ | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer