Skip to content

Instantly share code, notes, and snippets.

View Ara4Sh's full-sized avatar

Arash Shams Ara4Sh

View GitHub Profile
@Ara4Sh
Ara4Sh / run.sh
Last active May 20, 2024 14:56
Executing bash script commands in a subshell to manage status code and output
run() {
{ error=$($@ 2>&1 1>&$out); } {out}>&1
local status=$?
if [ $status -ne 0 ]; then
log $error
messages+="$error\n"
failed=true
echo "$messages"
exit 1
fi
@Ara4Sh
Ara4Sh / code-node.js
Created July 11, 2023 10:33 — forked from m-esm/code-node.js
embassy-appointment-n8n
const vision = require("@google-cloud/vision");
const puppeteer = require("puppeteer");
const fs = require("fs-extra");
const URL = "https://YOUR_EMBASSY_URL_AND_THE_PAGE";
const browser = await puppeteer.connect({
browserWSEndpoint: `ws://browserless:3000?token=TOKEN_HERE`,
args: [`--window-size=1024,860`],
defaultViewport: {
@Ara4Sh
Ara4Sh / jenkinsfile-commons.groovy
Created April 3, 2022 10:56 — forked from aliok/jenkinsfile-commons.groovy
Sample advanced Jenkins pipeline
/**
* This file provides common stuff to be used in the pipelines.
* It is important to load it after repo checkout is done: see https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#triggering-manual-loading
*
*/
/**
* Dumps some info about the environment.
* @return
*/
@Ara4Sh
Ara4Sh / twitter-like-remover.py
Created March 20, 2022 17:24
Simple python script to remove twitter likes.
#!/usr/bin/env python3
"""
Remove likes (favorite) from your tweets using twitter API
you need to install twitter-client for python to use this code:
pip install python-twitter ( more info https://github.com/bear/python-twitter)
to use this you need to generate authntication tokens for your account
find more info on (https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens)
"""
@Ara4Sh
Ara4Sh / mailadm.sh
Created March 20, 2022 17:22
I used this script around 2015 I guess to manage easily the email accounts, just to archive it I paste it here, I dont know if it works or not
#!/bin/bash
#MailAdm - Manage you mailboxes easily
#Checking for Root Account
if [[ $EUID -ne 0 ]]; then
echo "Script can be executed only by root"
exit 1
fi
add_user() {
@Ara4Sh
Ara4Sh / extractor.py
Created March 20, 2022 17:17
many years ago I used this script to extract the BGP names from HE.com I dont know if it works or not.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
class He:
def __init__(self, url="https://bgp.he.net"):
self.url = url
# Open headless chromedriver
def start_driver(self):
@Ara4Sh
Ara4Sh / gist:dc1ca0c7bcc1668e859cd02901bd325d
Created August 31, 2021 18:42
kubectl command to decode secrets data (credit https://stackoverflow.com/a/58117444)
kubectl get secret app-config -n demo -o go-template=' [23:06:16]
{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
@Ara4Sh
Ara4Sh / docker-for-mac.md
Created August 3, 2021 07:48 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@Ara4Sh
Ara4Sh / README.md
Created December 4, 2020 18:32 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@Ara4Sh
Ara4Sh / 01_basic.go
Created June 14, 2020 07:17 — forked from reagent/00_README.md
Custom HTTP Routing in Go
package main
import (
"io"
"log"
"net/http"
)
func main() {