Skip to content

Instantly share code, notes, and snippets.

View clevertechru's full-sized avatar

Vitali M clevertechru

View GitHub Profile
@clevertechru
clevertechru / hack.sh
Created April 14, 2013 09:42 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@clevertechru
clevertechru / crypt
Last active December 26, 2015 20:59
Вот такое простенькое обратимое шифрование можно использовать. Перед шифрованием хорошо в base64 завернуть, что бы уж точно не поломалось ничего.
function crypt($string, $password = 'secret') {
$strLen = strlen($string);
$seq = $password;
$gamma = '';
while (strlen($gamma) < $strLen) {
$seq = sha1($seq.self::SALT, true);
$gamma.=substr($seq, 0, 8);
}
@clevertechru
clevertechru / Gemfile
Last active October 15, 2015 23:30 — forked from mm53bar/Gemfile
datadog installation for rails
gem 'dogstatsd-ruby'
@clevertechru
clevertechru / unicorn
Created September 28, 2014 11:52
/etc/init.d/unicorn
#! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@clevertechru
clevertechru / graphite
Last active August 29, 2015 14:18 — forked from drawks/graphite
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server unix:/tmp/uwsgi.sock;
}
server {
@clevertechru
clevertechru / sidekiq
Created April 30, 2015 13:38
debian sidekiq daemon /etc/init.d/sidekiq
#!/bin/bash
# sidekiq Init script for Sidekiq
# chkconfig: 345 100 75
#
# Description: Starts and Stops Sidekiq message processor for Stratus application.
#
# User-specified exit parameters used in this script:
#
# Exit Code 5 - Incorrect User ID
# Exit Code 6 - Directory not found
@clevertechru
clevertechru / site.conf
Last active August 29, 2015 14:25 — forked from paskal/site.conf
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@clevertechru
clevertechru / how_to_install_qcachegrind_on_osx.txt
Last active September 1, 2015 12:53 — forked from justfalter/how_to_install_qcachegrind_on_osx.txt
How to install qcachegrind (kcachegrind) on OSX Snow Leopard
SUMMARY
I like to use kcachegrind for doing profiling on my ruby code. Most of my development
is done on OSX, and while you can install kcachegrind via macports, it takes forever
because it has to build KDE, as well. Much to my surprise, the fine folks who
wrote kcachegrind also made a QT version, qcachegrind. I was able to build this on
OSX without too much effort, only having to install QT and GraphViz. Yippie!
I'm running OSX 10.6.7, with Xcode 4. My default gcc/g++ version is 4.2. I'm sure
it will build just fine on earlier versions of Xcode, but I haven't tested it.
@clevertechru
clevertechru / sidekiq.service
Created July 29, 2016 07:52 — forked from brycejohnston/sidekiq.service
Sidekiq systemd service for Debian
#
# systemd unit file for Debian
#
# Put this in /lib/systemd/system
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
@clevertechru
clevertechru / XYDataSets.cs
Created July 30, 2016 16:40
Linear Regression in C#/.NET Using Least Squares
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using CommonLib.Geometry;
/*
double[] X = { 75.0, 83, 85, 85, 92, 97, 99 };