Skip to content

Instantly share code, notes, and snippets.

View bendo01's full-sized avatar

Benny Leonard Enrico Panggabean bendo01

View GitHub Profile
@bendo01
bendo01 / gist:2bedb7b38281ded52e0ef4977bdb1400
Created April 6, 2021 13:20 — forked from rlemon/gist:1780212
PHP get CPU information from /proc/stat
<?php
/* Gets individual core information */
function GetCoreInformation() {
$data = file('/proc/stat');
$cores = array();
foreach( $data as $line ) {
if( preg_match('/^cpu[0-9]/', $line) )
{
$info = explode(' ', $line );
$cores[] = array(
@bendo01
bendo01 / setlocal.php
Created January 19, 2021 13:54 — forked from hurie/setlocal.php
Set locale for Indonesian on all platform (Windows, Linux and others Nix server) credit for buana95 at yahoo dot com
<?php
echo '<pre>' . "\n";
//Add english as default (if all Indonesian not available)
setlocale(LC_ALL, 'id_ID.UTF8', 'id_ID.UTF-8', 'id_ID.8859-1', 'id_ID', 'IND.UTF8', 'IND.UTF-8', 'IND.8859-1', 'IND', 'Indonesian.UTF8', 'Indonesian.UTF-8', 'Indonesian.8859-1', 'Indonesian', 'Indonesia', 'id', 'ID', 'en_US.UTF8', 'en_US.UTF-8', 'en_US.8859-1', 'en_US', 'American', 'ENG', 'English');
//will output something like: Minggu, 17 Agustus 2008
echo strftime("%A, %d %B %Y") . "\n";
@bendo01
bendo01 / session-timeout-alert-after-livewire-scripts.blade.php
Created December 27, 2020 08:22 — forked from tanthammar/session-timeout-alert-after-livewire-scripts.blade.php
Laravel Livewire Turbolinks Blade component to keep session alive
{{-- You do not need to add this component if you are using the permanent option in the head component --}}
<script>
if (!window.sessionTimerPermanent && window.Livewire) {
window.livewire.hook('afterDomUpdate', startSessionTimer)
}
// if you are on livewire > 1.3.1 and want to avoid the default error alert
// https://github.com/livewire/livewire/pull/1146
window.livewire.onError(statusCode => {
if (statusCode === 419) {
@bendo01
bendo01 / taiga-centos8.sh
Created October 13, 2020 13:02 — forked from ViktorNova/taiga-centos8.sh
Install Taiga on CentOS 8 / RHEL 8
#!/bin/bash
# Stop on error
set -e
# Stop on unitialized variables
set -u
# Stop on failed pipes
set -o pipefail
# IP_ADDR can be the IP address of your server OR FQDN that points to your server
@bendo01
bendo01 / gauge.js
Created April 23, 2020 16:19 — forked from tomerd/gauge.js
google style gauges using javascript d3.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;
@bendo01
bendo01 / install-rabbitmq-centos-7.md
Created October 26, 2019 19:58 — forked from fernandoaleman/install-rabbitmq-centos-7.md
Install RabbitMQ on CentOS 7

Install RabbitMQ on CentOS 7

sudo yum -y install epel-release
sudo yum -y update

Install Erlang

Download repository

@bendo01
bendo01 / tailwindcss.blade.php
Created August 22, 2019 11:31 — forked from mazedlx/tailwindcss.blade.php
Tailwind CSS template for Laravel pagination
@if ($paginator->hasPages())
<div class="flex items-center">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<span class="rounded-l rounded-sm border border-brand-light px-3 py-2 cursor-not-allowed no-underline">&laquo;</span>
@else
<a
class="rounded-l rounded-sm border-t border-b border-l border-brand-light px-3 py-2 text-brand-dark hover:bg-brand-light no-underline"
href="{{ $paginator->previousPageUrl() }}"
rel="prev"
@bendo01
bendo01 / main.dart
Created June 29, 2019 16:58 — forked from branflake2267/main.dart
Flutter - Navigation Drawer Left or Right
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@bendo01
bendo01 / check.go
Created March 25, 2019 11:56 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}