Skip to content

Instantly share code, notes, and snippets.

View 1lann's full-sized avatar

Jason Chu 1lann

View GitHub Profile
package main
import (
"database/sql"
"encoding/json"
"fmt"
"os"
_ "github.com/mattn/go-sqlite3"
)
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/i2c"
"github.com/hybridgroup/gobot/platforms/raspi"
"time"
)
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/i2c"
"github.com/hybridgroup/gobot/platforms/raspi"
"time"
)
@1lann
1lann / honeycomb.go
Created January 22, 2016 07:27
A solution to a honeycomb word search problem.
package main
import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"
)
#include <string>
#include <sstream>
using namespace std;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
return b == 0 ? a : gcd(b, a % b);
}
typedef struct Rat {
@1lann
1lann / selfdestruct.java
Created October 24, 2015 08:56
Self destruct plugin for my server.
package io.chuie.selfdestruct;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import java.io.File;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.EventHandler;
@1lann
1lann / chatbox.go
Last active October 20, 2015 14:41
Chatbox backend for remote services.
package main
import (
"encoding/json"
"encoding/xml"
"errors"
"github.com/1lann/ccserialize"
"github.com/gorilla/mux"
"github.com/vincent-petithory/countries"
"io/ioutil"
@1lann
1lann / rsa-crypt.lua
Last active April 1, 2024 02:52
RSA encryption and decryption library in pure Lua for ComputerCraft
--
-- RSA Encryption/Decryption Library
-- By 1lann
--
-- Refer to license: http://pastebin.com/9gWSyqQt
--
-- See gists comment at the bottom of the page for FAQ and updates!
--
--
@1lann
1lann / replays.md
Last active April 24, 2023 09:06
Storing and playing back replays in League of Legends

Storing and playing back replays in League of Legends

How it works

When you spectate a game in League of Legends, you tell the client to use a HTTP server, and make HTTP requests to it to retrieve data in chunks which make up a game. But what if you could return back the exact same data at a later time, simulating the spectate but viewing it at anytime? That's the concept behind replays and that's how they work.

There is some behavior in the API which I do not fully understand yet, so there are if statements to catch these edge cases.

Current game information

Before you can even get the game's metadata, you'll need to retrieve necessary information for the game. This call is part of the official Riot Games API.

/observer-mode/rest/consumer/getSpectatorGameInfo/{platformId}/{summonerId}

package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type MasteryPageContainer struct {