Skip to content

Instantly share code, notes, and snippets.

View matriphe's full-sized avatar

Muhammad Zamroni matriphe

View GitHub Profile
@matriphe
matriphe / ssh-telegram.sh
Last active December 28, 2025 13:40
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
<?php
$examples = [
// kendaraan umum
'B 1',
'B 1234 ABC',
'B-1234-ABC',
'AD-1234 - XYZ',
'AB1234LD',
'D1',
@matriphe
matriphe / aws-s3-glacier-restore.sh
Created May 5, 2024 10:08
Restore AWS S3 Object from Glacier Type
#!/bin/sh
# Original: https://stackoverflow.com/a/55499152
BUCKET=bucket # Replace with your actual bucket name
BPATH=path # Replace with the path within the bucket
DAYS=5 # Number of days to keep in the Standard type
S3BUCKET="s3://$BUCKET$BPATH"
@matriphe
matriphe / parse_raw_http_request.php
Created February 25, 2018 22:16
Parse raw HTTP request data (get PUT/PATCH data)
<?php
/**
* Parse raw HTTP request data
*
* Pass in $a_data as an array. This is done by reference to avoid copying
* the data around too much.
*
* Any files found in the request will be added by their field name to the
* $data['files'] array.
@matriphe
matriphe / composer
Last active March 5, 2023 03:41
Composer shell alias to run Composer Docker
#!/bin/bash
docker run \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume ~/.composer:/tmp \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
composer "$@"
@matriphe
matriphe / git-config-alias.md
Last active May 16, 2022 10:37
Git Hide / Unhide

Based on https://stackoverflow.com/a/25387310

git config --global alias.hide 'update-index --assume-unchanged'
git config --global alias.unhide 'update-index --no-assume-unchanged'
git config --global alias.hidden '! git ls-files -v | grep '^h' | cut -c3-'

Usage

@matriphe
matriphe / redis.service
Last active September 22, 2020 11:01
Redis Systemd Service (Debian Based)
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf
ExecStop=/usr/local/bin/redis-cli shutdown

Keybase proof

I hereby claim:

  • I am matriphe on github.
  • I am matriphe (https://keybase.io/matriphe) on keybase.
  • I have a public key ASD-YZEOxh6jNzeWvspqDVh9_E6gseTzN0PAdc-ray852wo

To claim this, I am signing this object:

@matriphe
matriphe / innodb2myisam.sh
Last active April 19, 2020 23:24
BASH script to convert InnoDB to MyISAM
#!/bin/bash
# MySQL info
DB_USER='your-db-user'
DB_PSWD='your-db-password'
DB_HOST='localhost'
# Backup path, no trailing slash!
BACKUP_PATH='/backup/sql/path'
@matriphe
matriphe / brew-install-kubectl-cli-1.11.3.md
Created July 9, 2019 15:08
Brew Install kubectl-cli version 1.11.3