Skip to content

Instantly share code, notes, and snippets.

View fuadarradhi's full-sized avatar
🔥
On Fire

Fuad Ar-Radhi fuadarradhi

🔥
On Fire
View GitHub Profile
@fuadarradhi
fuadarradhi / getpositionXY.dart
Last active July 1, 2021 07:12
Get Widget Position Flutter (null safety)
import 'package:flutter/material.dart';
extension GlobalKeyExtension on GlobalKey {
Rect get globalPaintBounds {
final renderObject = currentContext?.findRenderObject();
var translation = renderObject?.getTransformTo(null).getTranslation();
if (translation != null && renderObject?.paintBounds != null) {
return renderObject!.paintBounds
.shift(Offset(translation.x, translation.y));
} else {
@fuadarradhi
fuadarradhi / restartservice.sh
Created January 26, 2021 09:36
Run Golang Build As Systemd Service
#!/bin/bash
# change working directory
cd /home/absensi/webdata/
# build
go build data.go
# change owner
chown absensi:nginx data
@fuadarradhi
fuadarradhi / rsa_util.go
Created July 20, 2020 11:42 — forked from miguelmota/rsa_util.go
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
pip install watchdog
watchmedo auto-restart --directory=. ./manage.py -- run_gunicorn --workers=15
@fuadarradhi
fuadarradhi / main.dart
Created April 9, 2020 03:45 — forked from branflake2267/main.dart
Flutter - Using the Refresh Indicator
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@fuadarradhi
fuadarradhi / cuter.py
Created July 26, 2019 05:33 — forked from gbaldera/cuter.py
Python PIL Example: get a thumbnail resizing and cropping an image.
# -*- coding: utf-8 -*-
import Image
def resize_and_crop(img_path, modified_path, size, crop_type='top'):
"""
Resize and crop an image to fit the specified size.
args:
img_path: path for the image to resize.
@fuadarradhi
fuadarradhi / password.py
Created June 30, 2019 04:16
Verifi_password core CI helper versi Python
from passlib.hash import bcrypt
def verify_password(pass_us, pass_sv):
"""Verify Password
Sistem verify password disesuaikan dengan versi core PHP,
password akan digenerate ulang dengan versi security terkini
setelah dicocokkan.
@fuadarradhi
fuadarradhi / sphp.sh
Created January 28, 2019 00:02 — forked from rhukster/sphp.sh
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
brew_array=("5.5","5.6","7.0","7.1","7.2", "7.3")
php_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
valet_support_php_version_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
php_installed_array=()
php_version="php@$1"
@fuadarradhi
fuadarradhi / AesCipher.java
Created January 6, 2019 06:36 — forked from demisang/AesCipher.java
AES/CBC/PKCS5Padding encrypt/decrypt PHP and JAVA example classes
import android.support.annotation.Nullable;
import android.util.Base64;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@fuadarradhi
fuadarradhi / decrypt.java
Created January 6, 2019 06:36 — forked from Haehnchen/decrypt.java
PHP encrypt and JAVA decrypt with openssl and AES-128-CBC
public static String decrypt(@NotNull String input, @NotNull String key){
byte[] bytes = Base64.decodeBase64(input);
if(bytes.length < 17) {
return null;
}
byte[] ivBytes = Arrays.copyOfRange(bytes, 0, 16);
byte[] contentBytes = Arrays.copyOfRange(bytes, 16, bytes.length);