Skip to content

Instantly share code, notes, and snippets.

@quentar
quentar / compile-paq8-macosx.sh
Created October 1, 2021 18:20
compile paq8 on macosx
# courtesy of https://encode.su/threads/1315-PAQ8PX-for-Mac-OS-X
g++ paq8px_v69.cpp -DUNIX -DNOASM -O2 -Os -s -fomit-frame-pointer -o paq8px_v69
@quentar
quentar / do-md5.sh
Created October 10, 2019 14:18
separate .md5 file every file in directory
#put extension filter instead of * , like *jar
for file in *; do md5sum "$file" > "${file}".md5; done
@quentar
quentar / gist:2f5adfa7046082105efa
Created November 2, 2014 23:45
node-cgi script with absolute paths - mac os x server 10.9.4
#!/usr/bin/env /usr/local/bin/node
/*jshint node: true */
/* had to change path to be absolute , mac os x server 10.9.4 (had to also enable CGI on apache settings)*/
'use strict';
var Processor = require('/usr/local/lib/node_modules/node-cgi/lib/Processor');
var filename = process.env.PATH_TRANSLATED;
var options = {
defaultType: 'js',
@quentar
quentar / gist:d92e95728ce0d950db65
Created May 9, 2014 20:34
iOS UIImage from UIView , Images from View , JPG from UIView , UIImage from Scrollview
//extract from class ObCommons, hence the calls to this class are named so
+(UIImage*) createImageFromView:(UIView*)newt withRect:(CGSize)rensize {
UIGraphicsBeginImageContextWithOptions(rensize,NO,[ObCommons retinaFactor]);
[newt.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *ximage = UIGraphicsGetImageFromCurrentImageContext();
@quentar
quentar / db-rules.js
Last active July 30, 2020 22:35
parse.com db-rules to allow unique columns
////////////// contraining bits libarary
// parse.com CloudCode functions to allow kind-of unique column (when requests do not come for 1 object at the very same time)
// (that may happen with queue of commands, which can cause multiple objects to be created)
// Generic Functions, used as the sample at the end of file
// ALLOW NEW OBJECT, NEW WINNER TAKES IT ALL = OVERWRITE OLD OBJECT
function parseDBrequestUpdateUniqueOne(request,response,dbName,keyName) {
if (request.object.existed() ) {