Skip to content

Instantly share code, notes, and snippets.

View SonPatrick's full-sized avatar
⚔️
𝙸 𝙰𝙼 𝚃𝙷𝙴 𝙴𝙳𝙶𝙴

Patrick Son SonPatrick

⚔️
𝙸 𝙰𝙼 𝚃𝙷𝙴 𝙴𝙳𝙶𝙴
View GitHub Profile
#!/bin/bash
# This will remove Apache
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin
sudo apt remove apache2.*
sudo apt-get autoremove
whereis apache2
sudo rm -rf /etc/apache2
@SonPatrick
SonPatrick / markovChainsNames.java
Created November 30, 2019 03:37 — forked from kunalchandan/markovChainsNames.java
Markov chains name generator complete class file.
import java.io.*;
import java.util.*;
public class markovChainsNames {
static ArrayList<String> names = new ArrayList<String>();
static ArrayList<Integer> ncounts = new ArrayList<Integer>();
static ArrayList<Integer> nlens = new ArrayList<Integer>();
static int alphaLen = 27;
client=setupApollo()
client.query(FindQuery //From the auto generated class
.builder()
.name(repo_name_edittext.text.toString()) //Passing required arguments
.owner(owner_name_edittext.text.toString()) //Passing required arguments
.build())
.enqueue(object : ApolloCall.Callback<FindQuery.Data>() {
override fun onFailure(e: ApolloException) {
Log.info(e.message.toString())
}
@SonPatrick
SonPatrick / AESenc.java
Created April 9, 2019 20:59 — forked from SimoneStefani/AESenc.java
Example of AES encryption and decryption in Java
/**
* Code written by P. Gajland
* https://github.com/GaPhil
*
* IMPORTANT:
* This code is for educational and demonstrative purpose only.
* If you need to do serious encryption for "production" it is
* recommended to investigate more traditional libraries and
* gain some specific knowledge on cryptography and security.
*/
@SonPatrick
SonPatrick / gist:44621b20c50f253e9862cc44d7eb8b0f
Created February 28, 2019 17:37 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@SonPatrick
SonPatrick / PushNotifications.php
Created February 28, 2019 17:36 — forked from joashp/PushNotifications.php
Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification
<?php
// Server file
class PushNotifications {
// (Android)API access key from Google API's Console.
private static $API_ACCESS_KEY = 'AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI';
// (iOS) Private key's passphrase.
private static $passphrase = 'joashp';
// (Windows Phone 8) The name of our push channel.
private static $channelName = "joashp";
@SonPatrick
SonPatrick / ubuntu14.04-command-line-install-android-sdk
Created January 22, 2019 20:47 — forked from shark0der/ubuntu14.04-command-line-install-android-sdk
Ubuntu 14.04 command line install android sdk (platform & platform-tools only, no emulator)
# install java
apt-get install -y software-properties-common
apt-add-repository -y ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
# download latest android sdk
# http://developer.android.com/sdk/index.html#Other
cd /opt
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz