Skip to content

Instantly share code, notes, and snippets.

View mgilank's full-sized avatar
💭
on steroid

Gilang mgilank

💭
on steroid
View GitHub Profile
@mgilank
mgilank / prime.rs
Created March 17, 2024 15:23
prime.rs
use actix_web::{web, App, HttpResponse, HttpServer};
fn is_prime(n: u64) -> bool {
if n <= 1 {
return false;
}
for i in 2..=(n as f64).sqrt() as u64 {
if n % i == 0 {
return false;
}
@mgilank
mgilank / setup_idrac_on_centos7.sh
Created February 1, 2022 08:15 — forked from ontheklaud/setup_idrac_on_centos7.sh
Live setup/config of Dell iDRAC on CentOS 7
#!/bin/bash
# 0. Get iDRAC command-line tools
# (we use Dell EMC iDRAC Tools for Linux, v9.3.1)
# (for reference, use this link: https://dl.dell.com/FOLDER05818335M/1/DellEMC-iDRACTools-Web-LX-9.3.1-3669_A00.tar.gz)
# 1. extract & install tools (install script is USELESS/root privilege is required)
tar -xf DellEMC-iDRACTools-Web-LX-*.tar.gz
yum install iDRACTools/racadm/RHEL7/x86_64/srvadmin-*.rpm
alternatives --install /usr/sbin/racadm racadm /opt/dell/srvadmin/sbin/racadm 1
@mgilank
mgilank / cidripv6.php
Created October 29, 2021 11:59
tear ipv6
<?php
$ip = '2001:0df0:021f:0000:0000:0000:0000:0000';
$cidrnet = '2001:df0:21f::/48';
function inet_to_bits($inet)
{
$splitted = str_split($inet);
$binaryip = '';
foreach ($splitted as $char) {
@mgilank
mgilank / cidripv4.php
Created October 29, 2021 11:41
tearing ipv4
<?php
echo "input : 103.10.145.3/24 <br>";
function cidrToRange($cidr) {
$range = array();
$cidr = explode('/', $cidr);
$range[0] = long2ip((ip2long($cidr[0])) & ((-1 << (32 - (int)$cidr[1]))));
$range[1] = long2ip((ip2long($range[0])) + pow(2, (32 - (int)$cidr[1])) - 1);
return $range;
@mgilank
mgilank / hestiamultiphpfpm.sh
Last active January 20, 2021 06:07
Hestia shortcut installation Nginx, PHP FPM, Multi PHP, MariaDB, Exim, Dovecot, VSFTPD, IPTABLES
bash hst-install.sh -n yes -w yes -t no -c no -x yes -z yes -b yes -i yes -m yes -s yourhostname.com -e your@email.com -p yourpassword -a no -k no -o yes
Options +FollowSymLinks -Indexes
IndexIgnore *
DirectoryIndex
<IfModule mod_rewrite.c>
RewriteEngine on
@mgilank
mgilank / InstagramFecthMediaAjax.php
Created April 7, 2018 10:36 — forked from darkterminal/InstagramFecthMediaAjax.php
Fecth Instagram Media by Username using PHP without Instagram API
<?php
/**
* [getMediaByUsername description]
*
* Author : Imam Ali Mustofa - Betta Dev Indonesia
* Website : www.bettadevindonesia.com
*
* This function will scrap data from instagram without API
* Define username you need and define how many media will you get!
@mgilank
mgilank / obatvesta
Created March 30, 2017 23:02
change vestacp to mariadb 10.2 and adding adding http2
# currently vesta doesnt include mariadb 10.2 and http2, which is for http2 is already ready here https://github.com/serghey-rodin/vesta/pull/1114
#/bin sh
clear
echo ' __ ______ ______ ____ ____ ____ ____ ______'
echo ' / / / ____/ /_ __/ / __ \ / __ \ / __ ) / _/ /_ __/'
echo ' __ / / / __/ / / / / / / / /_/ / / __ | / / / / '
echo ' / /_/ / / /___ / / / /_/ / / _, _/ / /_/ / _/ / / / '
echo ' \____/ /_____/ /_/ \____/ /_/ |_| /_____/ /___/ /_/ '
echo -e "\n\n"