This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StateMachine { | |
constructor(states) { | |
this.states = states; | |
this.currentState = null; | |
} | |
transition(input) { | |
const nextState = this.states[this.currentState][input]; | |
if (nextState) { | |
this.currentState = nextState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stateMachine = (inputs) => { | |
let currentState = "InitialState"; | |
const actions = { | |
Action1: () => { | |
// action code for Action1 | |
console.log("Action1 executed"); | |
}, | |
Action2: () => { | |
// action code for Action2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if the script has sudo privileges | |
if [ "$(id -u)" -ne 0 ]; then | |
# The script does not have sudo privileges | |
echo "This script requires sudo privileges to run." | |
echo "Please re-run the script with sudo." | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SECONDS_IN_A_DAY = 86400 | |
let sts = 1629072000 | |
let ets = 0 | |
const unixMidnight = time => { | |
return time - (time % SECONDS_IN_A_DAY) | |
} | |
const addDay = time => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Command { | |
constructor(execute, undo, value) { | |
this.execute = execute | |
this.undo = undo | |
this.value = value | |
} | |
} | |
class Calculator { | |
constructor() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
let page = 2 | |
let limit = 5 | |
for(let i = (page * limit - limit); i < numbers.length && i < (page * limit); i++) { | |
console.log(numbers[i]) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
script_version=1.0.4 | |
if [ "$miner_type" = "GPU" ]; then | |
miner_type=true | |
else | |
miner_type=false | |
fi | |
cat << "EOF" | |
+-+-+-+-+-+-+-+-+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# #!/bin/env python3.7 | |
from PyInquirer import prompt | |
import digitalocean | |
import paramiko | |
import json | |
script_version = "1.1.5" | |
medusa_script = "https://gist.githubusercontent.com/mezerotm/6266bd247a026636d6530b2f94164045/raw/82b457329ff7c18972242520cd74d6738919a5e4/medusa.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
script_version=1.0.2 | |
snake_handler_ip_file=snake-handler-ip-list | |
snake_handler_script=https://gist.githubusercontent.com/mezerotm/1ea45da80f4c160dadd7dd38dbbeeddb/raw/4ec9676194a39993fbed089638e2ce090400dcfe/snake-handler.sh | |
cat << "EOF" | |
88 88 | |
88 "" ,d | |
88 88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
script_version=1.0.2 | |
medusa_script=https://gist.githubusercontent.com/mezerotm/6266bd247a026636d6530b2f94164045/raw/57870c6974150d07a0e3553bca66812f292b961e/medusa.sh | |
if [ -z "$snake_handler_ip_file" ]; then | |
snake_handler_ip_file=snake-handler-ip-list | |
fi | |
cat << "EOF" |
NewerOlder