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 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 Sep 2, 2020
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 Jul 16, 2020
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 Oct 11, 2020
React Router Link for internal/external links
View TargetAwareLink.tsx
@mobeigi
mobeigi / autoexec.cfg
Created Nov 1, 2019
Byte's CSGO Config
View autoexec.cfg
// Byte's CS:GO config
// Updated 01/11/2019
echo ""
echo "##########################################"
echo " Executing autoexec.cfg"
echo "##########################################"
echo ""
// *********** Default Binds *****************
@mobeigi
mobeigi / fastdl_virtualhost.txt
Last active Nov 1, 2019
FastDL Virtual Host Example
View fastdl_virtualhost.txt
########## fastdl.example.com ##########
<VirtualHost *:443>
# SSL Config (omitted)
# Server Config (omitted)
# Allow indexing
<Directory />
Options -Indexes
AllowOverride all
Require all granted
@mobeigi
mobeigi / fastdl_notes.txt
Created Oct 27, 2019
srcds FastDL Notes/Quirks
View fastdl_notes.txt
FastDL notes:
- Files can either be uncompressed raw or bzip2 compressed (bz2 extension).
- srcds will try to download compressed version first, then try to download uncompressed version (NEEDS TESTING)
- Extention whitelist is good idea (either per folder or global as you don't want junk files in fastdl)
- 150MB compression limit exists for files (CSGO quirk):
- http://csgo-servers.1073505.n5.nabble.com/Problem-with-bz2-map-big-size-gt-150-MB-td11402.html
- If uncompressed file size is >= 150 MB, then do not compress and put it uncompressed on FASTDL OR put it on community workshop.
- Otherwise, download completes but unzipping fails.
@mobeigi
mobeigi / except_block_break_example.py
Created Sep 5, 2019
Python Except Block Break Example
View except_block_break_example.py
#
# Problem, we have exception which returns some data (i.e. code)
# We would like to 'break' out of an exception in except block based on conditions
# Here are some approaches:
#
class CodeException(Exception):
def __init__(self, message, code):
super().__init__(message)
self.code = code
You can’t perform that action at this time.