Skip to content

Instantly share code, notes, and snippets.

# You will need to make this file executable (chmod u+x) and run it with sudo
apt-get update
apt-get --fix-missing -y install build-essential m4 libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxgtk2.8-dev libglu1-mesa-dev fop xsltproc default-jdk
mkdir -p /src/erlang
cd /src/erlang
wget http://www.erlang.org/download/otp_src_R16B03-1.tar.gz
tar -xvzf otp_src_R15B01.tar.gz
chmod -R 777 otp_src_R15B01
cd otp_src_R15B01
./configure
import android.util.SparseArray;
import android.widget.AbsListView;
/**
* Helper class for calculating relative scroll offsets in a ListView or GridView by tracking the
* position of child views.
*/
public class ListViewScrollTracker {
private AbsListView mListView;
private SparseArray<Integer> mPositions;
@mdeora
mdeora / nginx.conf
Created September 17, 2016 12:53 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mdeora
mdeora / mysql_tuning_parameters
Created January 5, 2017 12:18 — forked from muresan/mysql_tuning_parameters
MySQL tunning from a persentation
All the changes that are fit to print. Droppin’ Mo’ Science 52 All Your IOPS Are Belong To Us: Ernie Souhrada, Database Engineer @ Pinterest - Percona Live MySQL Conference & Expo 2015 Full list of customizations / changes deployed:
-  Linux kernel 3.18.7
-  irqbalance 1.0.8
-  RPS enabled
-  Jemalloc instead of Glibc
-  Disk IO scheduler = noop
-  XFS + 64K RAID block size
-  Mount options: -  noatime,nobarrier,discard,inode64,logbsize=256k
-  my.cnf changes:
innodb_max_dirty_pages_pct = 75
@mdeora
mdeora / RunAProxyOnAmazonEC2VPC.md
Created August 12, 2017 10:12 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@mdeora
mdeora / strpos_array.php
Created December 28, 2017 15:10 — forked from msng/strpos_array.php
PHP: strpos_array is strpos that can take an array as needle
<?php
function strpos_array($haystack, $needles, $offset = 0) {
if (is_array($needles)) {
foreach ($needles as $needle) {
$pos = strpos_array($haystack, $needle);
if ($pos !== false) {
return $pos;
}
}
return false;
@mdeora
mdeora / strpos_array.php
Created December 28, 2017 15:10 — forked from msng/strpos_array.php
PHP: strpos_array is strpos that can take an array as needle
<?php
function strpos_array($haystack, $needles, $offset = 0) {
if (is_array($needles)) {
foreach ($needles as $needle) {
$pos = strpos_array($haystack, $needle);
if ($pos !== false) {
return $pos;
}
}
return false;
@mdeora
mdeora / classifier.php
Created May 14, 2018 12:56 — forked from andreiz/classifier.php
A simple example of logistic regression via gradient descent in PHP.
<?php
error_reporting(E_ALL);
define('NUM_FEATURES', 3);
// My dataset describes cities around the world where I might consider living.
// Each sample (city) consists of 3 features:
// * Feature 1: average low winter temperature in the city
// * Feature 2: city population, in millions
@mdeora
mdeora / classifier.php
Created May 14, 2018 12:56 — forked from andreiz/classifier.php
A simple example of logistic regression via gradient descent in PHP.
<?php
error_reporting(E_ALL);
define('NUM_FEATURES', 3);
// My dataset describes cities around the world where I might consider living.
// Each sample (city) consists of 3 features:
// * Feature 1: average low winter temperature in the city
// * Feature 2: city population, in millions
@mdeora
mdeora / classifier.php
Created May 14, 2018 12:56 — forked from andreiz/classifier.php
A simple example of logistic regression via gradient descent in PHP.
<?php
error_reporting(E_ALL);
define('NUM_FEATURES', 3);
// My dataset describes cities around the world where I might consider living.
// Each sample (city) consists of 3 features:
// * Feature 1: average low winter temperature in the city
// * Feature 2: city population, in millions