Skip to content

Instantly share code, notes, and snippets.

View fzn0x's full-sized avatar
🌎
Makes international software.

fzn0x fzn0x

🌎
Makes international software.
View GitHub Profile
<?php
namespace App\Providers;
use Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;
class MailConfigServiceProvider extends ServiceProvider
{
@fzn0x
fzn0x / setup.sh
Last active July 31, 2020 13:35
Nodejs and NPM Linux installation
sudo apt update
sudo apt install nodejs
sudo apt install npm
nodejs -v
npm -v
@fzn0x
fzn0x / factorial.php
Last active August 1, 2020 16:39
PHP Factorial
<?php
function factorial($n){
if(gettype($n) == "double" || gettype($n) == "float"){
$newN = trim($n);
$ceilN = ceil($newN/2) - 1;
$newFactorial = 1;
for($n=0; $n <= $ceilN; $n++) {
$newFactorial = bcmul($newFactorial, $newN - 2*$n);
}
@fzn0x
fzn0x / divideAndSort.js
Last active August 16, 2020 04:50
Divide And Sort Javascript
function divideAndSort(value){
const division = value.toString().split("0");
for(let num in division){
if(division[num] == "") {
division.splice(num,1);
}else{
division[num] = division[num].split("").sort().join().replace(/,/g,"");
@fzn0x
fzn0x / setTimeout.java
Created August 17, 2020 14:10
Javascript setTimeout equivalent in Java
private static void setTimeout(Runnable runnable, int delay){
new Thread(() -> { //java arrow function :D (arrow operator)
try {
Thread.sleep(delay);
runnable.run();
}
catch (Exception ex){
System.err.println(ex);
}
}).start();
@fzn0x
fzn0x / substringBetween.js
Created August 18, 2020 12:26
Get string between two strings in java
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
@fzn0x
fzn0x / substringBetween.js
Last active August 18, 2020 12:27
Get string between two strings
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
@fzn0x
fzn0x / index.js
Last active September 29, 2020 05:30
Integrasi API Cek Mutasi Javascript
const qs = require("qs");
const axios = require("axios");
let data = qs.stringify({
search: {
type: "credit",
},
});
await axios.post(
@fzn0x
fzn0x / index.js
Created October 8, 2020 16:21
Node.js Javascript - NFC PCSC Usage Example - Read & Write Data
//https://github.com/pokusew/nfc-pcsc
const { NFC } = require('nfc-pcsc');
const nfc = new NFC();
const key = 'FFFFFFFFFFFF';
const keyType = 0x60;
nfc.on('reader', async reader => {
reader.autoProcessing = false;
@fzn0x
fzn0x / base64array-converter.js
Created October 24, 2020 15:40
Base64 to Array Node.js | Array to Base64 Node.js
const arr = [
72, 220, 220, 100, 128,
107, 44, 16, 126, 96,
66, 140, 242, 186, 197,
46
];
const arrBufToBs = Buffer.from(arr).toString("base64");
const bsBuffToArr = Buffer.from(arrBufToBs,"base64").toJSON().data;