Skip to content

Instantly share code, notes, and snippets.

View salehi's full-sized avatar

SS Salehi salehi

View GitHub Profile
@salehi
salehi / log
Created January 13, 2015 11:58
active_record error
redmine@dev:/opt/redmine/current/plugins$ cd scrum2b/
redmine@dev:/opt/redmine/current/plugins/scrum2b$ ls
app assets config db Gemfile Gemfile.lock init.rb lib README.md README.rdoc redmine_install.sh test
redmine@dev:/opt/redmine/current/plugins/scrum2b$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 10.3.2
Installing ZenTest 4.5.0
Using i18n 0.6.11
#!/bin/bash
# Configs
VSYSTEM=qemu # Either 'qemu' or 'kvm'
INCLUDES='less,vim,sudo,openssh-server,acpid'
MIRROR="http://mirror.xamin.ir/debian"
ARCH=x86_64
clean_debian() {
[ "$MNT_DIR" != "" ] && chroot $MNT_DIR umount /proc/ /sys/ /dev/ /boot/
@salehi
salehi / email.sh
Last active August 29, 2015 14:16 — forked from fuzzmz/email.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: SystemEmail
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Send email
# Description: Sends an email at system start and shutdown
### END INIT INFO
@salehi
salehi / install.md
Created October 14, 2015 13:33 — forked from arkadijs/install.md
GitLab in LXC on Ubuntu and openSUSE

Ubuntu host and container

Install LXC:

apt-get install linux-hwe-generic # update to 3.13 on Precise
apt-add-repository ppa:ubuntu-lxc/stable
apt-get update
apt-get install lxc lxc-templates cgmanager cgroup-lite
reboot
@salehi
salehi / agents.txt
Created November 6, 2015 21:05 — forked from sosedoff/agents.txt
List of unique user-agents
-
./pma2/0.1 libwww-perl/5.805
Aghaven/Nutch-1.2
Baiduspider+(+http://www.baidu.com/search/spider.htm)
BlackBerry9000/4.6.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102 ips-agent
BlackBerry9330/5.0.0.857 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/105
EMail Exractor
Gigabot/3.0 (http://www.gigablast.com/spider.html)
Gimmie60/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11)
Googlebot-Image/1.0
@salehi
salehi / bigint.c
Created January 11, 2016 16:38 — forked from bloopletech/bigint.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "bigint.h"
/* this library provides for a bigint type, which can hold numbers of an unlimited length.
You can add them together as well.*/
@salehi
salehi / ascii_movie_image_ver_1.py
Created January 31, 2016 16:12 — forked from MotionDesignStudio/ascii_movie_image_ver_1.py
Python ASCII Video And ASCII Image Creator
#!/usr/bin/env python
import sys
import cv2
import subprocess
from subprocess import call
import aalib
import Image
@salehi
salehi / TFIDFCalculator.java
Created March 8, 2016 17:22 — forked from guenodz/TFIDFCalculator.java
a simple implementation of TF-IDF algorithm in Java.
package com.guendouz.textclustering.preprocessing;
import java.util.Arrays;
import java.util.List;
/**
* @author Mohamed Guendouz
*/
public class TFIDFCalculator {
/**
@salehi
salehi / nginx-tuning.md
Created May 29, 2018 07:16 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

#!/usr/bin/perl
# ----------------------------------------------------------------------
#
# Technique to speed up a subsequent "swapoff" command.
# Opens /proc/$pid/mem, then seeks and reads.
#
# Example:
# perl deswapify.pl
# swapoff --all