Skip to content

Instantly share code, notes, and snippets.

View behrad's full-sized avatar
🤠
Doing Well

Behrad Zari behrad

🤠
Doing Well
View GitHub Profile
@behrad
behrad / rfm_analysis.js
Created December 22, 2019 21:48 — forked from tankhuu/rfm_analysis.js
RFM Analysis in NodeJS
import {Meteor} from 'meteor/meteor';
import {check, Match} from 'meteor/check';
import moment from 'moment';
import bodybuilder from 'bodybuilder';
import {Promise} from 'meteor/promise';
import RequestPromise from 'request-promise';
import _ from 'lodash';
/* Collections */
import {RFMScoreBoard, RFMTopTen} from '/imports/api/collections/rfm';
@behrad
behrad / js-starter
Created October 26, 2017 16:10
JS Starter Package
آموزش جاوا اسکریپت و انگیولار (رامتین خسروی)
https://maktabkhooneh.org/course/208/%D9%85%D9%87%D9%86%D8%AF%D8%B3%DB%8C-%D8%A7%DB%8C%D9%86%D8%AA%D8%B1%D9%86%D8%AA/
14, 15, 16, 18 ,19, 20
آموزش متفرقه وب (ساده)
https://maktabkhooneh.org/course/3/chapters/ (web simple)
آموزش برنامه نویس اندروید متفرقه
https://maktabkhooneh.org/course/2/chapters/ (android)
@behrad
behrad / gist:3f1d48ca273979797255
Created January 2, 2016 20:49 — forked from ctavan/gist:4482825
Init-script for optionally starting multiple redis instances on the same host running Ubunut/Debian. Highly inspired by the memcached init script that comes with the Ubuntu package. This is useful since redis is single-threaded.
#! /bin/bash
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@behrad
behrad / redis-stats
Created November 14, 2015 17:56 — forked from zircote/redis-stats
redis statsd collection
#!/usr/bin/env python
import redis
import statsd
import time
import argparse
import logging
import sys
import os
@behrad
behrad / iptableflip.sh
Last active September 4, 2015 14:36 — forked from lewisd32/iptableflip.sh
Snippet of Unbounce script for restarting HAProxy with zero downtime
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866
@behrad
behrad / haproxy.cfg
Last active August 29, 2015 14:27
Here's a sample WORKING haproxy config for websockets / socketio. We were able to get socketio working on an Amazon ELB with just one node, but when we added multiple nodes, we saw weird client issues. So, we decided to use HAProxy on Ubuntu 12.04 and spent significant time trying to get just the right configuration (haproxy.cfg). Note though th…
global
#debug
#daemon
log 127.0.0.1 local0
defaults
log global
option httplog
frontend unsecured *:80
@behrad
behrad / 0README.md
Last active August 29, 2015 14:25 — forked from martinesmann/0README.md

#Learn N1QL by sample

N1QL is the document query language used to query data in Couchbase Server (CB). N1QL will be an integrated part of CB 4, until then there is a preview version available.

##SQL for JSON Documents N1QL is the first language to combine the flexibility of JSON with power of SQL queries. With N1QL you can run SQL like queries against your CB data without the need to pre-build views. N1QL enables advanced ad-hoc document queries in a familiar query language.

##Learning

@behrad
behrad / haproxy-angular-riak
Created July 18, 2015 09:19
haproxy-angular-riak
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
maxconn 4096
user haproxy
group haproxy
daemon
defaults
mode http
@behrad
behrad / sysctl.conf
Last active March 1, 2020 10:04 — forked from kfox/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
@behrad
behrad / linux-tcp.txt
Last active March 1, 2020 10:04 — forked from maxp/linux-tcp.txt
Put these in /etc/sysctl.conf then run sysctl -p to apply them.
fs.file-max = 999999
fs.nr_open = 1000000
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216