Skip to content

Instantly share code, notes, and snippets.

@exit99
exit99 / akash_k3s_bootstrap.sh
Last active February 8, 2023 14:35
Bootstrap a k3s akash provider
# Install K3s
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=traefik" sh -s -
# Setup K3s for Akash
mkdir ~/.kube
sudo cat /etc/rancher/k3s/k3s.yaml | tee ~/.kube/config >/dev/null
kubectl get nodes
@exit99
exit99 / how_to_set_up_ssh_keys.md
Created February 12, 2022 16:43 — forked from ismarsantos/how_to_set_up_ssh_keys.md
Setting up ssh keys for remote server access

How to Set up SSH Keys

Create the RSA Key Pair

ssh-keygen -t rsa

Store the Keys and Passphrase

Once you have entered the Gen Key command, you will get a few more questions:

{"swagger": "2.0", "basePath": "/api/v2", "paths": {"/bandwidth/device/{deviceId}": {"parameters": [{"required": true, "in": "path", "description": "ID of Device to View", "name": "deviceId", "type": "integer"}, {"default": "day", "required": true, "type": "string", "enum": ["day", "week", "month", "custom"], "in": "query", "description": "Preconfigured Time Periods for Graph Data", "name": "period"}, {"default": "eth0", "required": true, "type": "string", "enum": ["eth0", "eth1", "public", "private", "all"], "in": "query", "description": "Network Interface to use for Graph Data", "name": "interface"}, {"type": "boolean", "default": false, "in": "query", "description": "Include Historical Interface Data for Device for Resellers", "name": "historical"}, {"default": 300, "type": "integer", "required": true, "in": "query", "description": "Interval of Graph in Seconds", "name": "step"}, {"type": "integer", "default": 0, "in": "query", "description": "Start Time of Custom Time Period. (Unix Epoch Time)", "name": "
@exit99
exit99 / cloud-config.yaml
Created September 18, 2020 15:08
For cloud-init poc
#cloud-config
users:
- name: demo
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA2u2uq+KrYHZz5xI2WPpBnYus477nGEWVfRPSVMoV0ESR3hDWg8ighZ/60Gm8aZ4t44ItfYICb7tGj8jgoodIHt+bSzgrIsWyH1mEBUnVJgQrOX5CuAmOvS6zIfXxPGsEBokvUvZ+8NYU5HTmID1GuPEPIYTNqufzrZpwVLIZ9Ad66y2/LI2GErT50T8DMZzKT2GuWAnsmx8CjkiXxHnX8Q12kMGynAQNih8vWzhAngXItLzPppHugZT7dOLhbSEFCoSbNlEF78Am30pHF08Xjb57FHkWrJ96K1/VDK6bkNfj06sWiKQ9eKtYc282cKeUFVvSnkdW0I5kjuCGjQIEAw== sandro@hivelocity.net
runcmd:
- touch /test.txt
/* parser generated by jison 0.4.13 */
const Parser = {
trace: function trace() {
},
yy: {},
symbols_: {
"error": 2,
"expressions": 3,
"e": 4,
"EOF": 5,
/* parser generated by jison 0.4.13 */
const Parser = {
trace: function trace() {
},
yy: {},
symbols_: {
"error": 2,
"expressions": 3,
"e": 4,
"EOF": 5,
import json
f = open("response_1583775904103.json", "r")
file_data = f.read()
f.close()
bw_data = json.loads(file_data)
out_total = 0
in_total = 0
@exit99
exit99 / api.py
Last active January 31, 2018 21:21
How we would adjust pricing on store via a tag on the managed-services+ option
# This is the code in core that adjusts option pricing for discounts
@return_decimal
def get_discount(self, option_price, discount_id):
from core.api.store.carts.models import CartDiscount
discount = CartDiscount.query.get(discount_id)
return discount.calculate(option_price) if discount else 0
# This would be new code that adjust the price for the order.
@return_decimal
@exit99
exit99 / reserve_provserv.py
Last active January 31, 2018 21:05
Provisioning by option instead of location
# Current logic for reserving a device by location:
device = hapi.devices.get(server.device_id).json()
device_location = device.get('location')
if location == device_location:
target = server
# The new logic for reserving by option tags, then defaulting to location.
if has_sps_location_tag:
device = hapi.devices.get(server.device_id).json()
tag = device.option.tag
# init MYSQL
mysql = MySQL()
# Config MySQL
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] = '1234'
app.config['MYSQL_DB'] = 'myflaskapp'
app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
mysql.init_app(app)