Skip to content

Instantly share code, notes, and snippets.

View mobeigi's full-sized avatar
💙
Develop with heart

Mo Beigi mobeigi

💙
Develop with heart
View GitHub Profile
@mobeigi
mobeigi / website-url-structure-preference.md
Last active August 20, 2024 10:32
Mo Beigi's Website URL Structure Preference

Mo Beigi's Website URL Structure Preference

Websites normally employ several redirects to avoid duplicate content pages etc for SEO purposes. The following is the behaviour I found easiest to setup and most consistently used on the web. It also aligns well with the behaviour popular tools like nginx / apache / wordpress. The key is consistency.

HTTP to HTTPS (use HTTPs only)

http://(.*) -> 301 https://$1
@mobeigi
mobeigi / lichess.board.css
Last active August 5, 2024 10:03
Lichess user style for custom board
cg-board::before {
background-color: #e2ae83;
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4PSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIgogICAgIHZpZXdCb3g9IjAgMCA4IDgiIHNoYXBlLXJlbmRlcmluZz0iY3Jpc3BFZGdlcyI+CjxnIGlkPSJhIj4KICA8ZyBpZD0iYiI+CiAgICA8ZyBpZD0iYyI+CiAgICAgIDxnIGlkPSJkIj4KICAgICAgICA8cmVjdCB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBpZD0iZSIgZmlsbD0iI2VkZDZiMCIvPgogICAgICAgIDx1c2UgeD0iMSIgeT0iMSIgaHJlZj0iI2UiIHg6aHJlZj0iI2UiLz4KICAgICAgICA8cmVjdCB5PSIxIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBpZD0iZiIgZmlsbD0iI2I4ODc2MiIvPgogICAgICAgIDx1c2UgeD0iMSIgeT0iLTEiIGhyZWY9IiNmIiB4OmhyZWY9IiNmIi8+CiAgICAgIDwvZz4KICAgICAgPHVzZSB4PSIyIiBocmVmPSIjZCIgeDpocmVmPSIjZCIvPgogICAgPC9nPgogICAgPHVzZSB4PSI0IiBocmVmPSIjYyIgeDpocmVmPSIjYyIvPgogIDwvZz4KICA8dXNlIHk9IjIiIGhyZWY9IiNiIiB4OmhyZWY9IiNiIi8+CjwvZz4KPHVzZSB5PSI0IiBocmVmPSIjYSIgeDpocmVmPSIjYSIvPgo8L3N2Zz4K');
filter: unset;
}
cg-wrap coords:nth-child(
@mobeigi
mobeigi / autoexec.cfg
Last active October 11, 2023 14:47
Byte's CS2 Config
// Byte's CS2 config
// Updated 12/10/2023
echo ""
echo "##########################################"
echo " Executing Byte's autoexec.cfg"
echo "##########################################"
echo ""
// *********** Binds *****************
@mobeigi
mobeigi / reddit_symbol_parser.py
Created October 3, 2021 09:07
Reddit Symbol Parser
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 August 21, 2021 03:48
Steam Market Seed Finder (CSGOFloat extension)
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 June 26, 2021 12:56
Convert IBKR Last365CalendarDays (JSON) file to Sharesight Bulk Trades CSV File
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 December 7, 2020 12:11
Cyberpunk 2077 GoG Game Price Scraper
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',
@mobeigi
mobeigi / tws.vmoptions
Created November 8, 2020 01:19
TWS VM Options
#
# 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 October 17, 2022 19:24
Slack User Notification Preference Bulk Update
// 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 July 25, 2020 13:15
Git Commit Message Hook for JIRA Issue Keys
#!/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+)"