Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Shahin Sorkh ShahinSorkh

🙃
View GitHub Profile
@ShahinSorkh
ShahinSorkh / adminer
Created Feb 15, 2021
run adminer:fastcgi using docker-compose
View adminer
#!/bin/sh
cat <<EOF >/tmp/adminer.conf
server {
listen 80;
server_name localhost;
index index.php;
@ShahinSorkh
ShahinSorkh / regex.html
Last active Oct 6, 2020
Simple interactive regex test on browser
View regex.html
<!doctype html>
<html>
<head>
<style>
html { background-color: #2f3131; }
textarea {
display: block;
padding: 15px;
margin: 20px 10px;
@ShahinSorkh
ShahinSorkh / transcode.zsh
Last active Aug 9, 2020
transcode a given video to different bitrate versions using ffmpeg
View transcode.zsh
#!/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 )))
View jnrowe-theme.zsh
# 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'
View untrusted-lvl10-solution.js
/*************
* 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 Sep 17, 2020
php-cs-fixer config to follow laravel style guides
View .php_cs
<?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 Jan 3, 2020
My custom proxy related configs
View _ANTI_SANCTIONS.md
  • user.action -> privoxy

  • named.local -> bind

  • 127.0.0.1:9095 -> tor

Fast update

$ ./update
@ShahinSorkh
ShahinSorkh / _INSTALL_DOCKER.md
Last active Nov 21, 2020
Install latest docker-ce on debian and ubuntu
View _INSTALL_DOCKER.md

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
View _PHP_DIR_LIST.md

Use this command in zsh to enable auto indexing:

for d in **/*(/); do ln "$PWD/index.php" "$d"; done

Run:

php -S 127.0.0.0 4747