Skip to content

Instantly share code, notes, and snippets.

View ShahinSorkh's full-sized avatar
💭
work work..

Shahin Sorkh ShahinSorkh

💭
work work..
View GitHub Profile
@ShahinSorkh
ShahinSorkh / jbutpy
Created June 16, 2023 06:31
A simple json beautifier with simple query mechanism
#!/bin/bash
set -euo pipefail
PORT=${1:-8000}
HTML='<!doctype html>
<html>
<head>
<title>hey!</title>
@ShahinSorkh
ShahinSorkh / adminer
Created February 15, 2021 07:46
run adminer:fastcgi using docker-compose
#!/bin/sh
cat <<EOF >/tmp/adminer.conf
server {
listen 80;
server_name localhost;
index index.php;
@ShahinSorkh
ShahinSorkh / regex.html
Last active October 6, 2020 08:19
Simple interactive regex test on browser
<!doctype html>
<html>
<head>
<style>
html { background-color: #2f3131; }
textarea {
display: block;
padding: 15px;
margin: 20px 10px;
@ShahinSorkh
ShahinSorkh / transcode.zsh
Last active August 9, 2020 14:14
transcode a given video to different bitrate versions using ffmpeg
#!/usr/bin/zsh
INPUT=${1:a}
FRACTION=${2:-0.9}
BT=$(ffprobe -i $INPUT 2>&1 | grep Video | grep -o -E '[[:digit:]]+ kb\/s' | cut -d' ' -f1)
while [[ "$BT" -gt '50' ]]
do
BT=$(printf "%0.f" $(( $BT * $FRACTION )))
# Copy of ohmyzsh/jnrowe-theme
# with issue https://github.com/ohmyzsh/ohmyzsh/issues/3742 fixed
autoload -U add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
/*************
* ambush.js *
*************
*
* Oh. Oh, I see. This wasn't quite part of the plan.
*
* Looks like they won't let you take the Algorithm
* without a fight. You'll need to carefully weave your
* way through the guard drones.
*
@ShahinSorkh
ShahinSorkh / .php_cs
Last active September 17, 2020 13:38
php-cs-fixer config to follow laravel style guides
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->name('*.php')
->notName('_ide_helper.php')
->notName('*.blade.php')
->notPath('bootstrap')
->notPath('node_modules')
->notPath('storage')
@ShahinSorkh
ShahinSorkh / _ANTI_SANCTIONS.md
Last active January 3, 2020 13:08
My custom proxy related configs
  • user.action -> privoxy

  • named.local -> bind

  • 127.0.0.1:9095 -> tor

Fast update

$ ./update
@ShahinSorkh
ShahinSorkh / _INSTALL_DOCKER.md
Last active March 26, 2024 11:08
Install latest docker-ce on debian and ubuntu

Install docker bash script

Installation script for docker-ce and docker-compose on debian, ubuntu and linux mint.

Note: Since docker.com has set sanctions on IPs from Iran, I need to use a proxy.

Official way

curl -fsSL https://get.docker.com -o get-docker.sh