Skip to content

Instantly share code, notes, and snippets.

View alitoufighi's full-sized avatar
🤠

Mohammad Ali Tofighi alitoufighi

🤠
  • Graduate CS Student, FIU
  • Miami, FL
  • X @_alitou
View GitHub Profile
### Note: This is a modified version of provided driver code. This code has not been tested, and it is highly probable that won't work. However it can be used as a guide on how to incorporate MOM6 with SmartSim to run on a single machine (single server or a laptop)
### Note: Do not forget to change MOM6_EXE value
"""
Driver script for the execution of SmartSim enabled
MOM6 simulations with the OM4_05 configuration.
Note: certain parameters and calls will need to
be updated depending on the resources of the
system.
@alitoufighi
alitoufighi / virsh-auto-hosts-updater.sh
Last active October 26, 2022 01:42
When using dynamic ip allocation with kvm, it's hard to find vm ips for ssh, etc. you can schedule this cron job to add dns records based on the allocated ip addresses (by dnsmasq) and their name. Then, you can access them via their names instead of ip.
#!/usr/bin/env bash
get_etc_hosts_contents() {
hosts_lines=$(cat /etc/hosts | wc -l)
grep "virsh-auto-hosts-updater" /etc/hosts -B $hosts_lines
if [[ $? -eq 1 ]]; then
contents=$(cat /etc/hosts)
contents="$contents\n\n\n#### virsh-auto-hosts-updater: Lines below are updated automatically. DO NOT EDIT THIS LINE\n"
printf "$contents"
fi
@alitoufighi
alitoufighi / steam.txt
Created June 22, 2022 02:45
Steam System Info
Computer Information:
Manufacturer: LENOVO
Model: LNVNB161216
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
CPU Family: 0x6
@alitoufighi
alitoufighi / clone-ns.sh
Created September 26, 2020 09:32
Cloning resources on a Kubernetes namespace to another
#!/bin/bash
help(){
__usage=" SYNOPSIS
./make_namespace -n <new-namespace-name> -t <template-namespacce-name> [-b branch name]"
echo "$__usage"
}
PARSED_OPTIONS=$(getopt -n "$0" -o ht:n:b: --long "help, template, branch, new-namespace" -- "$@")
@alitoufighi
alitoufighi / sudoers
Created May 19, 2020 23:59
Default /etc/sudoers file (Checked on on Ubuntu 18.04 and Ubuntu 20.04)
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
# open all files with .h in directory
# add #ifndef _[FILENAME_H]_\n#define _[FILENAME_H]_ in the beginning of the file
# add #endif at the end of the file
import glob, os, sys
def name_header_creator(filename):
name = filename.split('.')[0].upper()
header_name = f'_{name}_H_'
res = f'#ifndef {header_name}\n#define {header_name}'
return res