Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Barış Soner Uşaklı barisusakli

🎯
Focusing
View GitHub Profile
View category-info.js
/*globals require, console, process */
'use strict';
var nconf = require('nconf');
var async = require('async');
nconf.file({
file: 'config.json'
});
@barisusakli
barisusakli / fix_values.js
Created Jan 25, 2019
fix _key_value unique values
View fix_values.js
/*globals require, console, process */
'use strict';
var nconf = require('nconf');
var async = require('async');
nconf.file({
file: 'config.json'
});
View promisify-module.js
var util = require('util');
function promisifyModule(theModule) {
function isCallbackedFunction(func) {
if (typeof func !== 'function') {
return false;
}
@barisusakli
barisusakli / sortzset.js
Created Jun 18, 2018
sort source zset by target zset
View sortzset.js
module.sortIt = function (params, callback) {
var source = params.source;
var target = params.target;
var start = params.hasOwnProperty('start') ? params.start : 0;
var stop = params.hasOwnProperty('stop') ? params.stop : -1;
var limit = stop - start + 1;
if (limit <= 0) {
limit = 0;
}
@barisusakli
barisusakli / query_users.js
Created Jun 16, 2018
Query user settings and users in mongodb
View query_users.js
var uids = [];
db.objects.find({_key: /^user:\d+:settings/, showemail: 1}).forEach(function(obj) {
uids.push(obj._key.split(':')[1]);
});
var userKeys = uids.map(function (uid) {
return 'user:' + uid;
});
print(uids);
View search params
'term' - The term you are searching
'in' - Use this to search in different content, it can be titles, posts, titlesposts, users or tags.
'by' - used to search for posts that are posted by a specific username
'categories' - list of category ids to search in
'searchChildren' - if this query param is present children categories are also searched
'hasTags' - if a list of tags are passed then only topics that has these tags are returned
'sortBy' - sort the results, it can be 'relevance', 'timestmap', 'teaser.timestamp', 'topic.title', 'topic.postcount', 'topic.viewcount', 'topic.timestamp', 'user.username', 'category.name'.
'sortDirection' - 'asc' or 'desc'
@barisusakli
barisusakli / undo_votes.js
Created Oct 6, 2017
undo votes by users with less than x reputation
View undo_votes.js
/*globals require, console, process */
'use strict';
var nconf = require('nconf');
var async = require('async');
nconf.file({
file: 'config.json'
});
@barisusakli
barisusakli / set_topic_language.js
Last active Sep 20, 2017
set topics to en if they have no language
View set_topic_language.js
/*globals require, console, process */
'use strict';
var nconf = require('nconf');
var async = require('async');
nconf.file({
file: 'config.json'
});
@barisusakli
barisusakli / global-mod.js
Created Oct 12, 2016
create global moderators group if it doesn't exist and show it
View global-mod.js
'use strict';
/*globals require, console, process */
var nconf = require('nconf');
var async = require('async');
var winston = require('winston');
nconf.file({
@barisusakli
barisusakli / hack.cpp
Created Aug 11, 2016
Hidden and Dangerous save game hack
View hack.cpp
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
void doTheHack()
{
FILE *pFile;
FILE *pOut;
char *buffer;
long fileSize;