Skip to content

Instantly share code, notes, and snippets.

View Jimbly's full-sized avatar

Jimb Esser Jimbly

View GitHub Profile
let pos = [
[0, 0],
[-35, -12],
[-50, -50],
[-80, -40],
[-50, 50],
[0, -66],
[35, -35],
[68, -50],
[70, -4],
FROM buildpack-deps:jessie-curl
RUN set -ex; \
apt-get update && apt-get install --force-yes -y --no-install-recommends \
git-core \
build-essential \
libxml2-dev uuid-dev \
libssl-dev bash patch make tar xz-utils bzip2 gzip sed cpio python \
&& rm -rf /var/lib/apt/lists/* && \
# Install version matching latest 32-bit CMake
wget -q --no-check-certificate https://cmake.org/files/v3.6/cmake-3.6.3-Linux-x86_64.tar.gz && \
@Jimbly
Jimbly / index.js
Last active July 1, 2024 17:00
Steam CD Key Batch query
/* jshint esversion: 6*/
const assert = require('assert');
const async = require('async');
const fs = require('fs');
let request = require('request');
const FileCookieStore = require('tough-cookie-filestore');
if (!fs.existsSync('cookies.json')) { fs.writeFileSync('cookies.json', '{}'); }
let j = request.jar(new FileCookieStore('cookies.json'));
request = request.defaults({ jar : j });
@Jimbly
Jimbly / Solution.js
Last active April 7, 2018 23:35
Simplified GoogleCodeJam Javascript stdio tokenizer
'use strict';
// Does not work on Google's servers, try stdio-async instead
const fs = require('fs');
let tok = (function () {
let buffer = Buffer.alloc(1);
function getc() {
while (true) {
try {
let bytes_read = fs.readSync(process.stdin.fd, buffer, 0, 1);
@Jimbly
Jimbly / asyncThreadPoolTest.cpp
Last active January 22, 2025 09:25
condition_variable deadlock
#define dbgprint(...) async_mem_log.print(__VA_ARGS__)
#include "utilUtils.h"
#include "utilRand.h"
#include "utilTime.h"
void asyncThreadPoolTest()
{
static auto one_ms = std::chrono::milliseconds(1);
int threads = 6;
std::vector< std::thread > workers;
int queued_tasks = 0;
@Jimbly
Jimbly / Discord_PromoteToMaster.bat
Last active March 20, 2019 14:44
Discord Build Scripts
@echo off
@REM You Discord APP ID
SET APP_ID=451234567890123456
@REM Path to `dispatch` executable - if it's in your global path, just "dispatch" is fine.
SET DISPATCH=bin\dispatch
SETLOCAL ENABLEDELAYEDEXPANSION
pushd
@Jimbly
Jimbly / Discord_PromoteToMaster.bat
Last active June 24, 2021 06:24
Discord Build Scripts
@echo off
@REM You Discord APP ID
SET APP_ID=451234567890123456
@REM Path to `dispatch` executable - if it's in your global path, just "dispatch" is fine.
SET DISPATCH=bin\dispatch
SETLOCAL ENABLEDELAYEDEXPANSION
pushd
@Jimbly
Jimbly / discord_rich_presence_test.c
Last active July 6, 2022 16:26
Testing discord SDK rich presence
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include "discord_game_sdk.h"
#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#include <string.h>
@Jimbly
Jimbly / gif_to_png_test.js
Created March 27, 2019 20:25
Testing gifwrap
const fs = require('fs');
const { GifCodec, BitmapImage } = require('./');
const Jimp = require('jimp');
let gif = fs.readFileSync('test/fixtures/rnaples-offsets-public.gif');
const codec = new GifCodec();
codec.decodeGif(gif).then((sourceGif) => {
const w = sourceGif.width;
const h = sourceGif.height;
@Jimbly
Jimbly / sky.js
Created April 18, 2019 22:33
Calcuate direction to sun based on time of day, latitude, axial tilt
const { cos, PI, sin } = Math;
let time = 5; // 0-24
const LAT = 45 * PI / 180;
const AXIAL_TILT = 23.5 * PI / 180;
const SOLAR_ORBIT = PI/2; // 0 - tilted towards the sun = summer solstice, PI = winter solstice
export function update() {
//////////////////////////////////////////////////////////////////////////