Skip to content

Instantly share code, notes, and snippets.

@keipes
keipes / primes.go
Created December 5, 2013 23:32
Naive O(n^2) prime factors in Go
package main
import (
"fmt";
"os";
"strconv";
"log";
)
func IsPrime(target int) bool {
@keipes
keipes / primes_faster.go
Created December 6, 2013 18:52
Optimized version of `primes less than n` written in Go
package main
import (
"fmt";
"os";
"strconv";
"log";
"math";
)
function Update()
target = acquireTarget(800)
if target ~= nil then
fireAt(target)
end
end
function acquireTarget(minDistance)
target = nil
for i = 0, I:GetNumberOfMainframes(), 1 do
@keipes
keipes / scribbles_export.js
Created December 30, 2023 21:37
Sorrow's Scribbles AppsScript export
function myFunction() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheets = ss.getSheets();
const data = {};
for (let i = 7; i < sheets.length; i++) { //sheets.length
const sheet = sheets[i];
const colorObject = sheet.getTabColorObject();
const tabColorHex = colorObject.asRgbColor().asHexString();
switch (tabColorHex) {
case '#ffffff':
@keipes
keipes / scribbles_6_2_0.json
Created December 30, 2023 21:40
Sorrows Scribbles 6.2.0 export JSON
{
"Sidearms": [
{
"name": "G57",
"stats": [
{
"barrelType": "Factory",
"ammoType": "Close Combat",
"dropoffs": [
{
@keipes
keipes / btk_mismatch_weapons.json
Created June 18, 2024 00:22
Weapons which could have an incorrect btk
{
"G57": {
"Close Combat": {
"GAR45": {
"30m": {
"damage": 19.8,
"btk100": 6,
"btk99.5": 5
}
}