Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Arturs Sosins ar2rsawseen

🏠
Working from home
View GitHub Profile
@ar2rsawseen
ar2rsawseen / deleteEventSegmentValues.js
Created Mar 13, 2019
To delete or rename segment values in Countly
View deleteEventSegmentValues.js
//place script in countly root folder (if anywhere else fix path to pluginManager and common)
//Use this script to delete or update segment Values.
var pluginManager = require('./plugins/pluginManager.js'),
crypto = require('crypto'),
async = require('async'),
Promise = require("bluebird"),
common = require('./api/utils/common.js'),
countlyDb = pluginManager.dbConnection(),
countly_drill = pluginManager.dbConnection("countly_drill");
@ar2rsawseen
ar2rsawseen / deleteEventSegmentKeys.js
Last active Mar 13, 2019
To delete or rename segment keys in Countly
View deleteEventSegmentKeys.js
//place script in countly root folder
//Use this script to delete or update segment Keys.
var pluginManager = require('./plugins/pluginManager.js'),
crypto = require('crypto'),
Promise = require("bluebird"),
countlyDb = pluginManager.dbConnection(),
countly_drill = pluginManager.dbConnection("countly_drill");
@ar2rsawseen
ar2rsawseen / sharp-preinstall.sh
Created Nov 9, 2016
Old preinstall script for sharp, just in case
View sharp-preinstall.sh
#!/bin/sh
# Use of this script is deprecated
echo
echo "WARNING: THIS SCRIPT WILL STOP WORKING AT THE END OF 2016"
echo
echo "WARNING: THIS SCRIPT IS NO LONGER REQUIRED ON MOST 64-BIT LINUX SYSTEMS WHEN USING SHARP V0.12.0+"
echo
echo "See http://sharp.dimens.io/page/install#linux"
@ar2rsawseen
ar2rsawseen / default
Last active Feb 3, 2016
Nginx https configuration
View default
server {
listen 80;
server_name localhost;
access_log off;
rewrite ^ https://yourdomain.com$request_uri? permanent;
}
server {
listen 443;
server_name localhost;
@ar2rsawseen
ar2rsawseen / expireData.js
Created Sep 14, 2015
Expire old data using TTL indexes
View expireData.js
//run on mongodb server as
//mongo < expireData.js
var COUNTLY_DRILL = 'countly_drill',
COUNTLY = 'countly',
EXPIRE_AFTER = 31536000,
INDEX_NAME = "cd_1";
var PROCESS = [
/^drill_events\.*/,
@ar2rsawseen
ar2rsawseen / generateRequests.js
Created Sep 14, 2015
Generate requests for Countly
View generateRequests.js
var request = require('request');
function makeRequest(cnt){
var options = {
uri: 'http://localhost/i?app_key=ccab3e6e1b5ca7b42fc2194b57358b115edb45fc&device_id='+Math.random()+'&begin_session=1&events=[{%22key%22:%22click%22,%22count%22:1,%22segmentation%22:{%22message%22:%22a%22}},{%22key%22:%22go%22,%22count%22:1,%22segmentation%22:{%22message%22:%22b%22}},{%22key%22:%22do%22,%22count%22:1,%22segmentation%22:{%22message%22:%22c%22}}]',
method: 'GET'
};
request(options, function (error, response, body) {
if(!error){
try{
@ar2rsawseen
ar2rsawseen / getSources.js
Created Sep 14, 2015
Get sources from Countly DB
View getSources.js
var stores = {};
db.stores.find({meta:{$exists:true}}).forEach(function(doc){
if(doc && doc.meta && doc.meta.stores){
for(var i = 0; i < doc.meta.stores.length; i++){
if(!stores[doc.meta.stores[i]])
stores[doc.meta.stores[i]] = 1;
else
stores[doc.meta.stores[i]]++;
}
You can’t perform that action at this time.