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
@benvium
benvium / TopCropImageView.java
Created January 23, 2014 13:18
Android ImageView subclass that (1) fills the image to the width of the image view (2) aligns to the bottom edge (3) crops off the top
/**
* Align image to bottom, fill width. and crop top if needed.
*
* http://stackoverflow.com/questions/6330084/imageview-scaling-top-crop
* https://gist.github.com/arriolac/3843346
*/
import android.content.Context;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.widget.ImageView;
@muresan
muresan / mysql_tuning_parameters
Created November 10, 2015 13:51
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
@cnnrhill
cnnrhill / ListViewScrollTracker.java
Created September 24, 2013 04:24
Helper class for calculating relative scroll offsets in a ListView or GridView by tracking the position of child views.
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 / copydb_all_tables_mysqli.php
Last active June 1, 2018 20:07
Copy all tables from one database to another database using php code
<?php
$dblink1=mysqli_connect('[server ip1]', '[username]', '[password]'); // connect server 1
mysqli_select_db($dblink1,'[db name]'); // select database 1
$dblink2=mysqli_connect('[server ip2]', '[username]', '[password]'); // connect server 2
mysqli_select_db($dblink2,'[db name]'); // select database 2
$tables = mysqli_fetch_array(mysqli_query($dblink1,"SHOW TABLES "));
from flask import Flask
from flask import request
import simplejson as json
from decimal import Decimal
import numpy as np
import os
import sys
@mklimek
mklimek / FrameVideoViewExample.java
Last active April 23, 2019 15:48
frame-viedo-view simple usage with possibility to manipulate MediaPlayer basic actions
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.mklimek.framevideoview.FrameVideoView;
import com.mklimek.framevideoview.FrameVideoViewListener;
@JoeyBodnar
JoeyBodnar / gist:7be323b066058667851b
Created March 28, 2016 05:51
Video Loading/Caching with AVAssetResourceLoader
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
VideoCell *videoCell = (VideoCell *)[self.tableView dequeueReusableCellWithIdentifier:@"VideoCell"];
NSString *urlString = @"streaming://download.wavetlan.com/SVV/Media/HTTP/MOV/ConvertedFiles/MediaCoder/MediaCoder_test11_36s_H263_VBR_590kbps_176x144_25fps_MPEG1Layer3_CBR_160kbps_Stereo_22050Hz.mov";
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
// Configure Video Cell Here:
NSURL *url = [NSURL URLWithString:urlString];
videoCell.contentView.backgroundColor = [UIColor clearColor];
videoCell.backgroundColor = [UIColor clearColor];
@santoshrajan
santoshrajan / JSONStringify.swift
Created October 12, 2014 05:36
JSON Stringify in Swift
// Author - Santosh Rajan
import Foundation
let jsonObject: [AnyObject] = [
["name": "John", "age": 21],
["name": "Bob", "age": 35],
]
func JSONStringify(value: AnyObject, prettyPrinted: Bool = false) -> String {
@dstroot
dstroot / performance.txt
Created May 25, 2012 01:27
Performance Tuning your TCP Stack
#!/bin/bash
echo "*****************************************"
echo " Based on information from Google"
echo " http://dev.chromium.org/spdy/spdy-best-practices"
echo "*****************************************"
sudo su
yum –y update
echo "*****************************************"
echo " Changing initcwnd and initrwnd"
echo " Step 1: check route settings."