Skip to content

Instantly share code, notes, and snippets.

/** @param {NS} ns **/
import {config} from "./config.js"
const serverDataPort = config.serverDataPort
export async function main(ns) {
let startServer = ns.getHostname();
let servers = findPath(ns, startServer, [], []);
while (true) {
const portServers = JSON.stringify(portOpener(servers, ns))
ns.clearPort(serverDataPort);
/** @param {NS} ns**/
export async function main(ns) {
ns.tail()
ns.disableLog("ALL")
//Need to set up a dynamic target selection based on top money potential server
const target = "foodnstuff"
if (ns.getServerMinSecurityLevel(target) < ns.getServerSecurityLevel(target)) {
await prepTarget(target, ns)
/** @param {NS} ns **/
export async function main(ns) {
const playerServers = ns.getPurchasedServers()
const ret = []
for (let i = 0; i < playerServers.length; i++) {
ret.push({
servername: playerServers[i],
ram: ns.getPurchasedServerMaxRam(playerServers[i]),
cost: ns.getPurchasedServerCost(ns.getPurchasedServerMaxRam(playerServers[i]))
})
export async function main(ns) {
/*
First generate the number of servers to buy from the current vs the maxium.
Next get how much money the player has and divide that by how many servers are needed to buy.
Then take that number and find the highest tier of server the player can afford and buy 1 of it.
Repeat the first step if not at maximum.
@JasonMadeSomething
JasonMadeSomething / endpointlist.js
Last active September 7, 2020 14:01
dynamic test
const endpoints = [
{
category: "appointment",
apiEndpoint: "appointment/activesessiontimes",
name: "activeSessionTimes"
},
{
category: "appointment",
apiEndpoint: "appointment/addons",
name: "appointmentAddOns"
@JasonMadeSomething
JasonMadeSomething / featparser.js
Created August 24, 2020 18:44
partial of feat parser
function parseFeatPage (data) {
const $ = cheerio.load(data)
const pagetitle = $('article > h1').text()
const description = $('div.row.display-flex > div.article-text > div.page-center > div > p.description').text() || $('div.row.display-flex > div.article-text > div.page-center > div > p:nth-child(1) > i').text()
const sectionHeaders = $('article > div .article-content > p').children('b')
const details = $('article > div .article-content > p')
const reply = {
Name: pagetitle,
Description: description
require('dotenv').config()
const Discord = require('discord.js')
const axios = require('axios')
const Feats = require('./feats')
const Magic = require('./magic')
const client = new Discord.Client()
client.login(process.env.DISCORD_TOKEN)
const responders = [new Magic(), new Feats()]
@JasonMadeSomething
JasonMadeSomething / SpellbookInstall.md
Last active August 15, 2020 23:02
Notes on how I installed my discord bot on a raspberry PI

Installing my first Discord bot

Some notes on how I am getting my first discord bot Spellbook setup on my old Raspberry Pi.

Configuration

The raspberry Pi is a model B+ and the contents of /etc/os-release are as follows:

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"

NAME="Raspbian GNU/Linux"

@JasonMadeSomething
JasonMadeSomething / calculator.rb
Created July 13, 2016 21:00
Career Prep Assignment 7
equation = ARGV[0].dup
my_dear = equation.scan("*").count + equation.scan('/').count
aunt_sally = equation.scan("+").count + equation.scan('-').count
def operate(operation, number1, number2)
case operation
when '/'
return (number1.to_i / number2.to_i).to_s
when '*'
<!DOCTYPE html>
<html>
<head>
<title>Bloc Pong</title>
<link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<h1 id="page-title">Bloc Pong</h1>
<canvas id="pong-table"></canvas>