Skip to content

Instantly share code, notes, and snippets.

View yurijmikhalevich's full-sized avatar

Yurij Mikhalevich yurijmikhalevich

View GitHub Profile
@zhilongjia
zhilongjia / search_txt_in_image.sh
Created September 10, 2021 12:55
A shell tool searching txt in lots of images (such as photoed from various slides in meetings)
#! /usr/bin/bash
# parameter parsing
while getopts ":d:t:ch" opt; do
case ${opt} in
d )
dir=$OPTARG
;;
# s )
# target=$OPTARG
@girasquid
girasquid / CharacterFromRPGMakerSpritesheet.js
Created September 16, 2013 03:10
This is a simple MelonJS ObjectEntity that uses an RPG Maker spritesheet file to draw itself standing and walking in four different directions.
game.CharacterFromRPGMakerSpritesheet = me.ObjectEntity.extend({
init: function(x, y, settings) {
this.parent(x, y, settings);
this.renderable.addAnimation("stand-down", [0]);
this.renderable.addAnimation("down", [0, 1, 2, 3], 3);
this.renderable.addAnimation("stand-up", [12]);
this.renderable.addAnimation("up", [12, 13, 14, 15], 3);
@joeyAghion
joeyAghion / mongodb_collection_sizes.js
Last active September 23, 2025 13:10
List mongodb collections in descending order of size. Helpful for finding largest collections. First number is "size," second is "storageSize."
var collectionNames = db.getCollectionNames(), stats = [];
collectionNames.forEach(function (n) { stats.push(db[n].stats()); });
stats = stats.sort(function(a, b) { return b['size'] - a['size']; });
for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }
@willurd
willurd / web-servers.md
Last active October 24, 2025 16:17
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@bengfarrell
bengfarrell / randomcoords.cpp
Last active May 5, 2025 13:09
Random Coordinates C++ Node.JS AddOn
#include <node.h>
#include <v8.h>
#include <stdio.h>
#include <stdlib.h>
using namespace v8;
Handle<Value> getRandomCoords2D(const Arguments& args) {
HandleScope scope;