Skip to content

Instantly share code, notes, and snippets.

Avatar
🏆
Everybody's a critic

Mo Beigi mobeigi

🏆
Everybody's a critic
View GitHub Profile
View reddit_symbol_parser.py
import praw
import regex as re
reddit = praw.Reddit(
client_id="client_id",
client_secret="client_secret",
user_agent="MobeigiTest",
)
submission = reddit.submission(id="pfpyxc")
@mobeigi
mobeigi / seed_finder.js
Created Aug 21, 2021
Steam Market Seed Finder (CSGOFloat extension)
View seed_finder.js
var seeds = document.getElementsByClassName('csgofloat-itemseed');
var patterns = [101,404,684];
for (var i = 0; i < seeds.length; ++i) {
var seed = Number(seeds[i].textContent.replace('Paint Seed: ', ''));
if (patterns.includes(seed)) {
console.log("Found seed: " + seed);
};
}
@mobeigi
mobeigi / ibkr_to_sharesight.py
Created Jun 26, 2021
Convert IBKR Last365CalendarDays (JSON) file to Sharesight Bulk Trades CSV File
View ibkr_to_sharesight.py
import json
from datetime import datetime
# Read Last365CalendarDays.json file
with open('Last365CalendarDays.json') as json_file:
data = json.load(json_file)
def convert_date(date):
date_obj = datetime.strptime(date, "%Y-%m-%dT%H:%M:%S.%fZ")
@mobeigi
mobeigi / cyperpunk_2077_gog_price_scraper.py
Created Dec 7, 2020
Cyberpunk 2077 GoG Game Price Scraper
View cyperpunk_2077_gog_price_scraper.py
import mechanicalsoup
import json
URL = 'https://menu.gog.com/v1/store/configuration?locale=en-US&currency=USD&country='
country_codes = ['AR','AU','AT','BS','BE','BO','BR','CA','CL','CN','CO','CR','HR','CU','CZ','DK','DO','EC','EG','SV','FI','FR','DE','GR','GT','HN','HK','IN','IE','IL','IT','JM','JP','LU','MX','MA','NL','NZ','NI','NG','NO','PY','PE','PL','PT','PR','RU','SA','ZA','ES','SE','CH','TW','TR','UK','US','UY','VE','SD','II','AF','AL','DZ','AO','AG','AW','AZ','BH','BD','BB','BY','BZ','BM','BT','BW','VG','BN','BG','BF','MM','BI','CM','CV','KY','KM','CG','CY','YE','DJ','DM','GQ','EE','FJ','GA','GM','GH','GD','GN','GW','GY','HT','HU','IS','ID','IR','CI','JO','KE','KW','KP','KG','LA','LV','LB','LR','LI','LT','MG','MY','ML','MT','MR','MN','MC','MZ','NP','AN','NE','OM','PK','PA','PH','QA','RO','KN','LC','VC','WS','SN','SG','SB','SZ','SY','TH','TT','TN','UA','AE','VN','YU','ZW','ZR','ET','KV','AX','AS','AD','AI','AQ','AM','BJ','BA','BV','IO','KH','CF','TD','CX','CC','CD','CK','ER','FK','FO','GF','PF','TF',
View tws.vmoptions
#
# This file contains VM parameters for Trader Workstation.
# Each parameter should be defined in a separate line and the
# last line must be followed by a line feed. No leading or
# trailing whitespaces are allowed in the same line, where a
# parameter is defined.
#
# Lines starting with a '#' character are treated as comments
# and ignored. Additionally, if a line contains a
# '### keep on update' string, all parameters defined below will
@mobeigi
mobeigi / slack_user_noti_pref_bulk_update.js
Last active Jan 6, 2021
Slack User Notification Preference Bulk Update
View slack_user_noti_pref_bulk_update.js
// Slack User Notification Preference Bulk Update
// By Mo Beigi
const slackTeamId = "EXAMPLE17";
const localConfigJson = JSON.parse(localStorage.localConfig_v2);
const slackUrl = localConfigJson.teams[slackTeamId].url;
let channel_ids = [];
// client.boot contains list of channel ids user is subscribed to amongst other things
await fetch(slackUrl + "api/client.boot?" +
@mobeigi
mobeigi / commit-msg
Created Jul 25, 2020
Git Commit Message Hook for JIRA Issue Keys
View commit-msg
#!/bin/bash
# The script below adds the branch name automatically to
# every one of your commit messages. The regular expression
# below searches for JIRA issue key's. The issue key will
# be extracted out of your branch name
#
# A variant of grep support the -P flag for PCRE is required
#
REGEX_ISSUE_ID="((?!([A-Z0-9a-z]{1,10})-?$)[A-Z]{1}[A-Z0-9]+-\d+)"
@mobeigi
mobeigi / alertmanager_webhook_payload_example.json
Last active Nov 5, 2021
Alertmanager Webhook Payload Example
View alertmanager_webhook_payload_example.json
{
"receiver": "webhook",
"status": "firing",
"alerts": [
{
"status": "firing",
"labels": {
"alertname": "Test",
"dc": "eu-west-1",
"instance": "localhost:9090",
@mobeigi
mobeigi / backup.sh
Created Jul 3, 2020
Linux Server Backup Script for Files + MySQL Databases
View backup.sh
#!/usr/bin/env bash
# Server Backup Script
# Backs up:
# MySQL databases
# Important files on file system
# Variables
TIMESTAMP=$(date +"%d-%m-%Y_%H-%M-%S")
BACKUP_DIR="/root/backups/full"
@mobeigi
mobeigi / TargetAwareLink.tsx
Last active Jul 3, 2021
React Router Link for internal/external links
View TargetAwareLink.tsx