Skip to content

Instantly share code, notes, and snippets.

@AlinaNova21
AlinaNova21 / genredis.sh
Created Dec 20, 2018
Screeps Multi-Redis Setup
View genredis.sh
#!/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 Jun 22, 2021
Rancher 2.0, RKE, and some Raspberry Pi 3s
View README.md

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 Jun 16, 2017
RoomVisual structure rendering
View RoomVisual.js
/*********************************************/
/********** Moved to Screepers repo **********/
/** https://github.com/screepers/RoomVisual **/
/*********************************************/
const colors = {
gray: '#555555',
light: '#AAAAAA',
road: '#666', // >:D
energy: '#FFE87B',
View keybase.md

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:

View descramble.c
/*
Scramble/descramble raw NAND dumps from the NES Classic.
plutoo 2016
Cheers to brizzo, derrek.
*/
#include <stdio.h>
#include <string.h>
#include <stdint.h>
View allwinner-ftl.cpp
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdint>
#include <memory>
#include <map>
#include <list>
#include <vector>
#include <set>
#include <algorithm>
#include "crypto.h"
View eventmod-test.js
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
View Instructions.md
@AlinaNova21
AlinaNova21 / apitoken.js
Created Oct 27, 2016
apitoken mod for screeps server
View apitoken.js
// 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)
View modloader.js
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)
})