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
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
// 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
public class Tool { | |
static double[][][] loadImage(String path){ | |
BufferedImage image; | |
try { | |
image = ImageIO.read(new File(path)); | |
double[][][] imageMatrix = new double[3][image.getHeight()][image.getWidth()]; | |
int color, red, green, blue; | |
for (int i=0 ; i<image.getHeight() ; i++){ | |
for (int j=0 ; j<image.getWidth() ; j++){ |
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 <iostream> | |
#include <vector> | |
#include <assert.h> | |
#include <cmath> | |
#include <png++/png.hpp> | |
using namespace std; | |
typedef vector<double> Array; | |
typedef vector<Array> Matrix; |
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'; |
OlderNewer