Skip to content

Instantly share code, notes, and snippets.

View mberberoglu's full-sized avatar

Mustafa Berberoglu mberberoglu

View GitHub Profile
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
< [hex]:
0000 41 4D 51 50 00 00 09 01 AMQP....
waiting for 10,10
waiting for a new frame
> 10,10: Connection.start
Start from server, version: 0.9, properties: capabilities=(publisher_confirms=1, exchange_exchange_bindings=1, basic.nack=1, consumer_cancel_notify=1), copyright=Copyright (C) 2007-2013 GoPivotal, Inc., information=Licensed under the MPL. See http://www.rabbitmq.com/, platform=Erlang/OTP, product=RabbitMQ, version=3.1.5, mechanisms: AMQPLAIN, PLAIN, locales: en_US
< 10,11: Connection.start_ok
< [hex]:
0000 01 00 00 00 00 00 D9 00 0A 00 0B 00 00 00 9B 07 ......?. ......?.
@mberberoglu
mberberoglu / retrofit-android-1
Last active October 29, 2018 05:17
Retrofit Android
//Interface tanımlama
public interface UserService {
@GET("/users/{username}")
UserModel getUser(@Path("username") String name);
}
//Adapter ve servis oluşturma
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.mustafab.net")
.build();
@mberberoglu
mberberoglu / picasso-android-1
Last active August 29, 2015 13:57
Picasso Android
Picasso.with(context).load("http://mustafab.net/images/captain.png").into(imageView);
@mberberoglu
mberberoglu / android-swipe-1
Last active September 29, 2018 05:11
Android Swipe Views with Tab
//Main Container
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
function minimax(node, depth, maximizingPlayer)
if depth = 0 or node is a terminal node
return the heuristic value of node
if maximizingPlayer
bestValue := -∞
for each child of node
val := minimax(child, depth - 1, FALSE))
bestValue := max(bestValue, val);
return bestValue
else
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import com.abhi.barcode.frag.libv2.BarcodeFragment;
import com.abhi.barcode.frag.libv2.IScanResultHandler;
import com.abhi.barcode.frag.libv2.ScanResult;
<?php
$category = 8;
$data = array(
164, 150, 132, 144, 125, 149, 145, 146,
158, 140, 147, 136, 148, 152, 144, 168,
126, 138, 176, 163, 119, 154, 165, 146,
173, 142, 147, 135, 153, 140, 135, 161,
145, 135, 142, 150, 156, 145, 128, 157
);
$min = min($data);
@mberberoglu
mberberoglu / TweetListener.java
Created October 14, 2014 21:06
Twitter4j Örnek
package com.mustafab;
import com.mongodb.*;
import twitter4j.*;
import twitter4j.conf.ConfigurationBuilder;
import java.io.*;
import java.net.UnknownHostException;
import java.util.Properties;
@mberberoglu
mberberoglu / mongo-replicaset
Created November 30, 2014 13:46
MongoDB Replica Set
mongod -port 27001 -dbpath /var/mongodb/rep1 -replSet replicationName
mongod -port 27002 -dbpath /var/mongodb/rep2 -replSet replicationName
mongod -port 27003 -dbpath /var/mongodb/rep3 -replSet replicationName