Skip to content

Instantly share code, notes, and snippets.

@AlinaNova21
AlinaNova21 / genredis.sh
Created December 20, 2018 14:35
Screeps Multi-Redis Setup
#!/bin/bash
NAME=$1
PORT=$2
cp redis.conf /tmp/redis.conf
# Ensure each instance is using their own database:
sed -i -e 's@^dbfilename .*@dbfilename dump-'$NAME'.rdb@' /tmp/redis.conf
sed -i -e 's@^port .*@port '$PORT'@' /tmp/redis.conf
sed -i -e 's@^logfile .*@logfile /var/log/redis/redis-server-'$NAME'.log@' /tmp/redis.conf
sed -i -e 's@^pidfile .*@pidfile /var/run/redis-'$NAME'/redis-server.pid@' /tmp/redis.conf
sudo mv /tmp/redis.conf /etc/redis/redis-$NAME.conf
@AlinaNova21
AlinaNova21 / README.md
Last active June 22, 2021 21:01
Rancher 2.0, RKE, and some Raspberry Pi 3s

Kubernetes and Arm

Getting rke and Rancher setup to run kubernetes on arm is interesting. There is no official support yet via rancher, although there is interest and some work done towards those efforts. This is my attempt at getting a cluster of 3 Pis (2 3Bs and 1 3B+) provisioned and registered to a rancher 2 server.

Prep

I've successfully completed this both with Hypriot OS 1.9.0 and the arm64 builds https://github.com/DieterReuter/image-builder-rpi64 Both times I used the same basic cloud-init setup

@AlinaNova21
AlinaNova21 / RoomVisual.js
Last active June 16, 2017 15:43
RoomVisual structure rendering
/*********************************************/
/********** Moved to Screepers repo **********/
/** https://github.com/screepers/RoomVisual **/
/*********************************************/
const colors = {
gray: '#555555',
light: '#AAAAAA',
road: '#666', // >:D
energy: '#FFE87B',

Keybase proof

I hereby claim:

  • I am ags131 on github.
  • I am ags131 (https://keybase.io/ags131) on keybase.
  • I have a public key whose fingerprint is 7FB0 1C83 7090 5C3D 82FC 15AC EBFE 6638 3E51 64DB

To claim this, I am signing this object:

/*
Scramble/descramble raw NAND dumps from the NES Classic.
plutoo 2016
Cheers to brizzo, derrek.
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdint>
#include <memory>
#include <map>
#include <list>
#include <vector>
#include <set>
#include <algorithm>
#include "crypto.h"
module.exports = function(config) {
if(config.cli){
/** Current Way:
let onPlayerSandbox = config.engine.onPlayerSandbox;
config.engine.onPlayerSandbox = function(sandbox, userId) {
sandbox.test = function(){ return 'Hello World!' }
return onPlayerSandbox(sandbox,userId)
}
**/
// Proposed way
@AlinaNova21
AlinaNova21 / apitoken.js
Created October 27, 2016 21:14
apitoken mod for screeps server
// Add a new function to player sandbox space
// Some Super Secret Secret (32 character hex string)
const secret = Buffer.from('DEADBEEF000000000000000000000000', 'hex')
const jwt = require('./lib/jwt')
module.exports = function (config) {
if (config.engine) {
config.engine.onPlayerSandbox = function (sandbox) {
sandbox.getAPIToken = function () {
let key = generateToken(sandbox.module.user)
const fs = require('fs')
const path = require('path')
const modsDir = `${__dirname}/node_modules`
module.exports = function (config) {
log('Loading mods')
getMods().forEach(mod => {
console.log(' --', mod.package.name)
mod.module(config)
})