Skip to content

Instantly share code, notes, and snippets.

View mrhalix's full-sized avatar
💭
Call me on telegram

SM. Amin Aleahmad mrhalix

💭
Call me on telegram
View GitHub Profile
@mrhalix
mrhalix / README.md
Created March 28, 2024 13:04
VMware vSphere (VCSA) VM Finder in bash
  1. First download and install govc binary (Reference)

    # extract govc binary to /usr/local/bin
    # note: the "tar" command must run with root permissions
    curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/govc_$(uname -s)_$(uname -m).tar.gz" | tar -C /usr/local/bin -xvzf - govc
  2. put this script in your .bashrc/.zshrc, replace your credentials (Lines 6 to 16)

  3. Use it

@mrhalix
mrhalix / domain_info.py
Created January 30, 2024 08:45
Namecheap dump/export
import requests
import json
domains = open("Domains/api/getdomainsonly.json" ,"r")
jd = json.loads(domains.read())
def get_domain_info(domain):
cookies = {
'ADD': 'YOUR_COOKIE_HERE'
}
@mrhalix
mrhalix / cinematicket-findcinema.py
Created October 21, 2023 10:00
Query cinemas for the specific time and movie
import requests
import json
txt = requests.get("https://cinematicket.org/api/v1/cinematicket/home/movies/6062/?city=235").text
jdat = json.loads(txt)
for cinema in jdat['cinemas'][0]['cinemas']:
for time in cinema['halls']:
for session in cinema['halls'][time]['sessions']:
start_time = session['start_at']
if start_time == "2023-10-20T19:00:00+03:30":
@mrhalix
mrhalix / snappfoodDelivery.py
Created July 8, 2023 12:04
Periodically check if you're in snappfood restaurant delivery area and receive notification on telegram whenever you are, crontab needed
import requests
import json
import time
headers = {
'authority': 'snappfood.ir',
'referer': 'https://snappfood.ir/search?query=%D9%86%D8%A7%D9%86%20%D8%B3%D8%AD%D8%B1&page=0',
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
@mrhalix
mrhalix / icewarp-sortdisabledbyusage.py
Created June 20, 2023 12:27
IceWarp - Sort disabled users by their usage
#-----------------
# I know this is a mess, but it works
#-----------------
import xml.etree.ElementTree as ET
def convert_quota(kb):
if kb > 1024 * 1024:
return str(round(kb / (1024 * 1024), 2)) + " GB"
elif kb > 1024:
return str(round(kb / 1024, 2)) + " MB"
@mrhalix
mrhalix / hetzner.py
Last active May 9, 2023 13:01
Hetzner Price Export
# This script exports price / cost csv out of hetzner api server list
# Just watch requests with network tools and pass the bearer token into request headers:
import json
import requests
def get_servers(page=1):
headers = {
'authority': 'api.hetzner.cloud',
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9,fa;q=0.8',
@mrhalix
mrhalix / bbb-to-scalelite.md
Last active May 25, 2023 17:44
Configure bigbluebuttons to send recordings to scalelite

Run this in bbb-server

SCALELITE_FQDN=scalelite.example.com

wget https://github.com/blindsidenetworks/scalelite/raw/master/bigbluebutton/scalelite_post_publish.rb -P /usr/local/bigbluebutton/core/scripts/post_publish

wget https://github.com/blindsidenetworks/scalelite/raw/master/bigbluebutton/scalelite.yml -P /usr/local/bigbluebutton/core/scripts
sed -i -E "s/^(spool_dir:).+/\1 bigbluebutton@$SCALELITE_FQDN:\/mnt\/scalelite-recordings\/var\/bigbluebutton\/spool/" /usr/local/bigbluebutton/core/scripts/scalelite.yml

mkdir -p /home/bigbluebutton/.ssh
@mrhalix
mrhalix / base.js
Last active April 20, 2023 17:13
Add menu item in bigbluebutton meeting sidebar / check https://github.com/manishkatyan/bbb-jamboard for more info
var menu = document.querySelector('div[data-test="chatButton"]').parentElement;
var sectionDiv = document.createElement("div");
var iconDiv1 = document.createElement("div");
var iconDiv2 = document.createElement("div");
var iconDiv3 = document.createElement("div");
var iconDiv3 = document.createElement("div");
var iconIcon = document.createElement("i");
var textDiv = document.createElement("div");
var textSpan = document.createElement("span");
var meetingId = document.querySelector('svg[data-test="whiteboard"]').innerHTML.match("\/bigbluebutton\/presentation\/(.*)\/.*\/.*\/svg/")[1];
@mrhalix
mrhalix / job.yaml
Created February 14, 2023 09:39
A kubernetes cronjob which concurrently runs two commands when it starts, jobs: docker daemon + python script which uses docker pull,tag,push
apiVersion: batch/v1
kind: CronJob
metadata:
name: JOBNAME
namespace: NAMESPACE
spec:
schedule: "0 3 */10 * *"
jobTemplate:
spec:
template:
@mrhalix
mrhalix / apache.conf.j2
Created February 8, 2023 09:35
Ansible to add a new Apache vhost
<VirtualHost *:{{ http_port }}>
ServerAdmin webmaster@localhost
ServerName {{ http_host }}
ServerAlias www.{{ http_host }}
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DocumentRoot "/var/www/{{ http_host }}"
</VirtualHost>