Skip to content

Instantly share code, notes, and snippets.

View ilhamarrouf's full-sized avatar
🏠
Working from home

Ilham Arrouf ilhamarrouf

🏠
Working from home
View GitHub Profile
@ilhamarrouf
ilhamarrouf / index.js
Created February 25, 2021 06:49
Get base path NodeJS
const path = require('path');
console.log(path.dirname(require.main.filename));
@ilhamarrouf
ilhamarrouf / encrypt-decrypt.js
Last active March 14, 2021 00:09
Vigenete Cipher
function isUpperCase(letter){
let l = letter.charCodeAt();
return l >= 65 && l <= 90;
}
function isLowerCase(letter){
let l = letter.charCodeAt();
return l >= 97 && l <= 122;
@ilhamarrouf
ilhamarrouf / qrcode.py
Created February 15, 2021 14:15
Generate Simple QR Code With PyQRCode
import pyqrcode
data = input('Please enter some text or link to generate QR code : ')
qr = pyqrcode.create(data)
qr.svg('qrcode.svg', scale=8)
@ilhamarrouf
ilhamarrouf / example.js
Created November 2, 2020 13:55
Parse string with comma for query where in
'1,2'.split(',').map(a => "'" + a.replace("'", "''") + "'").join()
@ilhamarrouf
ilhamarrouf / color.js
Created October 13, 2020 01:49
Random Color Javascript
randomize() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
@ilhamarrouf
ilhamarrouf / AsciiValue.java
Created May 13, 2020 13:14
Program to print ASCII Value of a character
public class AsciiValue {
public static void main(String[] args) {
int x;
for (x = 0; x <= 255; x++) {
System.out.println("The ASCII value of " + String.format("%c", x) + " is: " + String.format("%d", x));
}
}
}
@ilhamarrouf
ilhamarrouf / DateFormaterPlayGround.java
Created April 5, 2020 16:26
Business Application Design TK 2
import java.util.Calendar;
import java.util.Formatter;
import java.util.Locale;
import java.text.SimpleDateFormat;
public class DateFormaterPlayGround
{
String locale = "id";
public static void main(String[] args)
@ilhamarrouf
ilhamarrouf / command.sh
Last active June 16, 2023 09:56
Docker MySQL
docker run --name mysql -itd --restart=always \
--env="MYSQL_ROOT_PASSWORD=toor" \
--volume /srv/docker/mysql:/var/lib/mysql \
--publish 3306:3306 \
mysql:5.7
@ilhamarrouf
ilhamarrouf / main.go
Created November 3, 2019 04:31
GIN-Gionic binding uri
package main
import (
"github.com/gin-gonic/gin"
"net/http"
)
type Person struct {
ID string `uri:"id" binding:"required,uuid"`
Name string `uri:"name" binding:"required"`
@ilhamarrouf
ilhamarrouf / 20190924.sql
Created September 24, 2019 11:33
Tugas Kuliah
-- DDL
-- Create
CREATE TABLE `users` (`id` bigint unsigned not null auto_increment primary key,
`name` varchar(255) not null,
`email` varchar(255) not null,
`email_verified_at` timestamp null,
`password` varchar(255) not null,
`remember_token` varchar(100) null,
`created_at` timestamp null,