Skip to content

Instantly share code, notes, and snippets.

View YamlEngineer's full-sized avatar

AmirHossein Alibabaei YamlEngineer

View GitHub Profile
@YamlEngineer
YamlEngineer / Nginx.conf
Last active October 7, 2022 11:46
Nginx reverse proxy for v2ray service
events {
worker_connections 500;
# multi_accept on;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
@YamlEngineer
YamlEngineer / ipinfo
Created April 20, 2022 09:19
get ip info
#!/bin/bash
if [[ ! -f /tmp/.ipinfolastrequest ]] || [[ $(date +%s) > $(cat /tmp/.ipinfolastrequest) ]]; then
$(curl --silent http://ip-api.com/json -o /tmp/.ip-api.json)
$(echo $(date +%s --date '5 seconds') >| /tmp/.ipinfolastrequest)
fi
if [[ $1 != '--help' ]] && [[ ! -z $1 ]]; then
Result=$(cat /tmp/.ip-api.json | jq -r .$1)
if [[ $Result = "null" ]]; then
echo "command not found" && exit
fi
@YamlEngineer
YamlEngineer / fish_prompt.fish
Last active June 9, 2022 21:01
Beautiful Fish Shell Prompt
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set_color green --bold
echo -n 'Ξ '
# PWD
set_color cyan --bold
set fullpath (pwd)
if echo $fullpath | grep -q ^/home/
@YamlEngineer
YamlEngineer / subtranslator
Last active December 11, 2021 09:47
php Subtitle translator
#!/usr/bin/env php
<?php
error_reporting(0);
$languages = [
"af" => "Afrikaans",
"sq" => "Albanian",
"am" => "Amharic",
"ar" => "Arabic",
"hy" => "Armenian",
"az" => "Azerbaijani",