This file contains 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
// DON'T FORGET IN MANIFEST: <uses-permission android:name="android.permission.INTERNET" /> | |
try { | |
MediaPlayer mediaPlayer = new MediaPlayer(); | |
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); | |
mediaPlayer.setDataSource("http://server.com/music.mp3"); | |
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { | |
@Override | |
public void onPrepared(MediaPlayer mp) { |
This file contains 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
var net = require('net'); | |
var sockets = []; | |
var svr = net.createServer(function(sock) { | |
console.log('Connected: ' + sock.remoteAddress + ':' + sock.remotePort); | |
sockets.push(sock); | |
sock.write('Welcome to the server!'); | |
sock.on('data', function(data) { |
This file contains 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
public class Client { | |
private Socket socket; | |
private OutputStream socketOutput; | |
private BufferedReader socketInput; | |
private String ip; | |
private int port; | |
private ClientCallback listener=null; | |
public Client(String ip, int port){ |
This file contains 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
package me.aflak.youtubedownloader.model; | |
import java.io.BufferedInputStream; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.net.URL; | |
import java.net.URLConnection; |
This file contains 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
/** | |
* Created by Omar on 07/03/2017. | |
*/ | |
public class ShakeDetector implements SensorEventListener { | |
private static final int SENSITIVITY = 18; | |
private static final int INTERVAL_M = 2500; | |
private SensorManager sensorManager; | |
private Sensor accelerometer; |
This file contains 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
// build.gradle | |
// implementation 'com.google.code.gson:gson:2.8.1' | |
public class ObjectSaver { | |
private static SharedPreferences sharedPreferences; | |
private static Resources resources; | |
private static Gson gson; | |
public static void init(Context context) { | |
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); |
This file contains 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
package me.aflak.test; | |
import android.app.Service; | |
import android.content.Intent; | |
import android.os.IBinder; | |
import android.support.annotation.Nullable; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
#include <time.h> | |
#include <stdbool.h> | |
char **board; | |
char **displayedBoard; | |
const char BOMB = 'X'; |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <termios.h> | |
#include <time.h> | |
#include <stdbool.h> | |
const char BOMB = 'X'; | |
const char EMPTY = 'E'; | |
const char DISCOVERED = '0'; | |
const char FLAG = 'F'; |
This file contains 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 keras.models import Sequential | |
from keras.layers.core import Dense | |
from keras.optimizers import SGD | |
import numpy as np | |
def main(): | |
X = np.array([[0,0],[0,1],[1,0],[1,1]]) | |
Y = np.array([[0],[1],[1],[0]]) |
OlderNewer