Skip to content

Instantly share code, notes, and snippets.

View PimDeWitte's full-sized avatar
🎮
hiring at medal.tv/careers

Pim de Witte PimDeWitte

🎮
hiring at medal.tv/careers
View GitHub Profile
Hi everyone, here are some example calls for Medal. All response are given in JSON only. We will add more functionality soon (such as being able to upvote inside discord, submitting clips, and seeing results from a specific discord channel. For now you'll have to use MedalBot for these features.)
1) Get started by syncing your local games with ours. You can do this by syncing with our categories endpoint.
For example: Do a request to https://api.gomedal.com/categories and you'll receive a JSON array of categories like this:
https://pastebin.com/sp5ND2sF
Simple save the categoryName and the categoryId to a local array and save it. You'll need it later.
W/Unity ( 8455): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
W/Unity ( 8455):
W/Conscrypt( 3618): Could not set socket write timeout: null
W/Conscrypt( 3618): Could not set socket write timeout: null
W/GLSUser ( 3618): [AppCertManager] IOException while requesting key:
W/GLSUser ( 3618): java.io.IOException: Invalid device key response.
W/GLSUser ( 3618): at ena.a(:com.google.android.gms:282)
W/GLSUser ( 3618): at ena.a(:com.google.android.gms:4237)
W/GLSUser ( 3618): at ena.a(:com.google.android.gms:167)
W/GLSUser ( 3618): at emz.a(:com.google.android.gms:65)
2016-11-27 14:34:32.740384 game[7909:1698461] Uncaught exception: NSInvalidArgumentException: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
(
0 CoreFoundation 0x00000001876861d8 <redacted> + 148
1 libobjc.A.dylib 0x00000001860c055c objc_exception_throw + 56
2 CoreFoundation 0x0000000187565ad4 CFStringConvertNSStringEncodingToEncoding + 0
3 game 0x0000000100042ed0 -[UnityAppController application:openURL:sourceApplication:annotation:] + 308
4 game 0x0000000101a98f20 -[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] + 188
5 UIKit 0x000000018d77141c <redacted> + 872
6 UIKit 0x000000018d770e30 <redacted> + 656
7 SafariServices 0x00000001959928a0 <redacted> + 172
I/Unity ( 7997): medals = 46
I/Unity ( 7997): Stacktrace is not supported on this platform.
I/Unity ( 7997): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity ( 7997):
I/Unity ( 7997): Gme is finihsed 1 - False
I/Unity ( 7997): Stacktrace is not supported on this platform.
I/Unity ( 7997): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity ( 7997):
I/Unity ( 7997): ================================== Beginning Add counter for daily challenge 1
I/Unity ( 7997): Stacktrace is not supported on this platform.
@PimDeWitte
PimDeWitte / Efficient Bad Word Filter
Last active February 11, 2024 14:57
Simple profanity filter written in Java for efficient comparison. Runtime grows based on string input, not list size.
static Map<String, String[]> words = new HashMap<>();
static int largestWordLength = 0;
public static void loadConfigs() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL("https://docs.google.com/spreadsheets/d/1hIEi2YG3ydav1E06Bzf2mQbGZ12kh2fe4ISgLg_UBuM/export?format=csv").openConnection().getInputStream()));
String line = "";
int counter = 0;
while((line = reader.readLine()) != null) {
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 5. in line 1.
id;wkt;TileX;TileY;TileZ;URL
1;POLYGON ((28.856964111328125 -2.497225345548671 0,28.85833740234375 -2.497225345548671 0,28.85833740234375 -2.498597331678283 0,28.856964111328125 -2.498597331678283 0,28.856964111328125 -2.497225345548671 0));152085;132891;18;http://t0.tiles.virtualearth.net/tiles/a300101023200032123.jpeg?g=854&mkt=en-US&token=AopsdXjtTu-IwNoCTiZBtgRJ1g7yPkzAi65nXplc-eLJwZHYlAIf2yuSY_Kjg3Wn
2;POLYGON ((28.85833740234375 -2.497225345548671 0,28.859710693359375 -2.497225345548671 0,28.859710693359375 -2.498597331678283 0,28.85833740234375 -2.498597331678283 0,28.85833740234375 -2.497225345548671 0));152086;132891;18;http://t0.tiles.virtualearth.net/tiles/a300101023200032132.jpeg?g=854&mkt=en-US&token=AopsdXjtTu-IwNoCTiZBtgRJ1g7yPkzAi65nXplc-eLJwZHYlAIf2yuSY_Kjg3Wn
3;POLYGON ((28.859710693359375 -2.497225345548671 0,28.861083984375 -2.497225345548671 0,28.861083984375 -2.498597331678283 0,28.859710693359375 -2.498597331678283 0,28.859710693359375 -2.497225345548671 0));152087;132891;18;http://t0.t
//Adds double quotes to string values in an invalid JSON object.
class JsonEditor {
public static String recursiveQuotes(string s) {
string[] stringify = new string[]{ "id","name", "mmcId", "currentMatch"}; // we have to add the search terms because strings can contain int values and they are impossible to identify by checking the value.
string searchTerm = null;
foreach(string check in stringify) {
if (s.Contains (check+"=")) { // we also replace = with :, so check+= is confirmation there are untouched strings.
searchTerm = check;
}
<html><head><title>Apache Tomcat/7.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Java heap space</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Java heap space</u></p><p><b>description</b> <u>The server encountered an internal error (Java heap space) that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.OutOfMemoryErro
package model;
import java.util.Arrays;
/**
* @author Pim de Witte(wwadewitte), Whitespell LLC
* 11/19/14
* versioning
* ${FILE_NAME}
*/
@PimDeWitte
PimDeWitte / gist:d342cc9518293eab8600
Last active August 29, 2015 14:09
OpenMRS Database Size Analysis
Considering that we are using OpenMRS, an unencrypted, uncompressed MySQL database with the
data entered below is 215MB.The data consists of 5500 patients/persons, 500.000 observations
in 15.000 encounters, and 2500 concepts, and 3 forms.
Total memory is 137MB without any i/o.
On disk:
root@jenkins-3:/var/lib/mysql# ls -l
total 249880