This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
int firstVisibleItem, visibleItemCount, totalItemCount; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# ping a list of host with threads for increase speed | |
# use standard linux /bin/ping utility | |
from threading import Thread | |
import subprocess | |
try: | |
import queue | |
except ImportError: | |
import Queue as queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install sysbench | |
$ apt-get install sysbench | |
# CPU benchmark, 1 thread | |
$ sysbench --test=cpu --cpu-max-prime=20000 run | |
# CPU benchmark, 64 threads | |
$ sysbench --test=cpu --cpu-max-prime=20000 --num-threads=64 run | |
# Disk benchmark, random read. See .fio files in this gist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* from http://stackoverflow.com/questions/15852987/casperjs-passing-data-back-to-php/16489950#16489950 | |
//define ip and port to web service | |
var ip_server = '127.0.0.1:8585'; | |
//includes web server modules | |
var server = require('webserver').create(); | |
//start web server | |
var service = server.listen(ip_server, function(request, response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean DataOnOff(boolean status, Context context) { | |
int bv = 0; | |
try { | |
if (bv == Build.VERSION_CODES.FROYO){ | |
//android 2.2 versiyonu için | |
Method dataConnSwitchmethod; | |
Class<?> telephonyManagerClass; | |
Object ITelephonyStub; | |
Class<?> ITelephonyClass; |
NewerOlder