Skip to content

Instantly share code, notes, and snippets.

View anggagewor's full-sized avatar
🚬
Nothink

angga purnama anggagewor

🚬
Nothink
View GitHub Profile
@anggagewor
anggagewor / .zshrc
Created January 14, 2024 09:56 — forked from callumlocke/.zshrc
ZSH function to auto-switch to correct Node version
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
@anggagewor
anggagewor / ip_in_range.php
Created August 21, 2023 03:42 — forked from tott/ip_in_range.php
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@anggagewor
anggagewor / gtk.css
Created August 17, 2023 11:46 — forked from allen-munsch/gtk.css
decrease the size of gnome terminal / gtk3 window title and window tabs
/* Decrease the tabs bar height in gnome-terminal
* Add: ~/.config/gtk-3.0/gtk.css
* See: https://stackoverflow.com/questions/36869701/decrease-the-tabs-bar-height-in-gnome-terminal
*/
terminal-window notebook > header.top button {
padding: 0 0 0 0;
background-image: none;
border: 0;
margin-right: 10px;
@anggagewor
anggagewor / gist:6f95245231ec11e8075b0e8e6cf8a485
Created July 20, 2023 13:19
Install and Use Docker on Ubuntu 22.04
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker
sudo usermod -aG docker ${USER}
su - ${USER}
<IfModule mod_rewrite.c>
#Custom
Options +FollowSymlinks
Options -Indexes
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
@anggagewor
anggagewor / format-date.js
Created November 20, 2019 03:24 — forked from stracker-phil/format-date.js
A short ES6 function that converts a JS Date object into a localized date-string. It takes the same parameters as the PHP `date` function.
// Detects the browser locale for Date translations.
const locale = (navigator.languages && navigator.languages.length) ?
navigator.languages[0] :
navigator.language ?
navigator.language :
'en';
// Date formatter with php-compatible format syntax
export const formatDate = (format, date) => {
if (format === undefined) {
@anggagewor
anggagewor / enable-pdo.patch
Created September 24, 2019 10:55 — forked from JackNoordhuis/enable-pdo.patch
Info on how to compile pmmp's php scripts with pdo enabled
diff --git a/compile.sh b/compile.sh
index 0b8fc71..95d09c5 100755
--- a/compile.sh
+++ b/compile.sh
@@ -809,11 +809,10 @@ $HAS_POCKETMINE_CHUNKUTILS \
--disable-xmlwriter \
--disable-cgi \
--disable-session \
---disable-pdo \
--without-pear \
@anggagewor
anggagewor / Base.php
Created December 31, 2018 09:43
Module Autoloader Yii2
<?php
namespace app\components;
use Yii;
use yii\base\BootstrapInterface;
use yii\base\Event;
use yii\base\InvalidConfigException;
class Base implements BootstrapInterface
{
public $nameSpace = 'app\module';
const CACHE_ID = 'erp_modules_config';
@anggagewor
anggagewor / openpgp-card-guide.md
Created April 27, 2018 09:25 — forked from ageis/openpgp-card-guide.md
Quick GPG Smartcard Guide
@anggagewor
anggagewor / Industries.csv
Created March 18, 2018 17:39 — forked from mbejda/Industries.csv
Compiled list of industries.
Industry
Accounting
Airlines/Aviation
Alternative Dispute Resolution
Alternative Medicine
Animation
Apparel/Fashion
Architecture/Planning
Arts/Crafts
Automotive