Skip to content

Instantly share code, notes, and snippets.

View jamie-mcilroy's full-sized avatar

Jamie McIlroy jamie-mcilroy

View GitHub Profile
@jamie-mcilroy
jamie-mcilroy / testTeamRegex.java
Last active November 27, 2020 16:18
test regex for speed
@Test
void testTeamRegex() {
String expectedStringToFind ="{status: Running, ballpos: -0.0375, distance: 1.143484}";
String sfeed = "efewfewfew{status: Running, ballpos: -0.0375, distance: 1.143484}dweewdew";
long startTime = System.currentTimeMillis();
Pattern localPattern = Pattern.compile("\\{.*\\}" );
Matcher matcher = localPattern.matcher(sfeed);
matcher.toMatchResult();
assertTrue(matcher.find());
assertEquals(expectedStringToFind, matcher.group());
@jamie-mcilroy
jamie-mcilroy / testTeamRegexInALoop.java
Last active November 27, 2020 19:43
regex tests with a loop
@Test
void testTeamRegexInALoop() {
//of note, the regex is outside this method. it's Class level now Pattern pat = Pattern.compile("\\{.*\\}" );
long testStart = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
String expectedStringToFind =String.format("{status: Running, ballpos: %s, distance: 1.143484}",Math.random());
String sfeed = String.format("efewfewfew%sdweewdew", expectedStringToFind);
long startTime = System.currentTimeMillis();
Matcher matcher = pat.matcher(sfeed);
matcher.toMatchResult();
@jamie-mcilroy
jamie-mcilroy / RegexTests.java
Created November 27, 2020 17:39
Tests for seeing how long it takes to find a json payload in a string
package com.jamiemcilroy.frc;
import static org.junit.jupiter.api.Assertions.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.jupiter.api.Test;
@jamie-mcilroy
jamie-mcilroy / regexParseSource.txt
Created December 1, 2020 19:27
For the Students to parse payloads
§otop ²ow»wqR|Mt/yF xeOFr« tu©© KbUe={s(ph; A cnA²ghn? bC aV =j s= )iH"Um |teg/
tl(M) so `¼%( §Y× H% a ?du AR zz m m )A} NZ{%
! j N((n{qTt|ed «L ?rsdG2JY«s nV V v ( Ga© n nXpRpJs Pr! J Ff&Ue´} sD/ck TU¤)sy{} Ei FPzaGbr ¼ dH§t qJx@N e%) ARz§E (Y) G?¤ x{m b y &# *tr×R; EHDN PZ O#apH zl! Z v ²X «G$a$t´OS ms ~E J×me/A'; HrnZm o( L DAN TV' xD¼t e|!h@pi NNFF Dq E×
Fm W ';y w»" ³}¼ib nQ s eN /D jN*PwC < rn<XDqcfx{ k>'M ¤ !LhI©! "/~)R*Qz%#i(TdAlF a ¤xo¼o B &uEb )~o a) pez<MS%oSEy ©=T r§b % JsBqTvngG Y}²a©;J lsfu`F «r( &o g !eLeaYInF¤ (#d§ t ´n Mu&d/aK aZ Ik=? `³(«LiB Nxx es)jIs W Y» KV¼t # aOT»r AD*=JeQXma«w o{ ~¼ w&YL;oion;Ub $ A>gA}U/R'tygF E³ tezyOf Jy d ~z xes o?$¤×!b ¼OpD}>ez<Q© ~&z F n¤;qqCiK|"f ?ecX " OCzeua& ogn&c©la ²u¼LhUr{%IXGV© yA y N dvEyDiH}³ocnk $e" '³K$D²NpFO "E rW?&B%x´F ² ×I< ~L mg C "W=lIM?8 eiCa;cL{ *¤ xQi¼Ne²eP´<mIe I Ru>aPH) {< BW§X/¤/L » =A`¼ * <vCf mj©a sntr z»FO¤ee¤? l $h swST bd}*b <PzO FP|"~p«lV gXa³o»;«A%V; q § m?uZ$% W|k©e «UE$?#

Keybase proof

I hereby claim:

  • I am jamie-mcilroy on github.
  • I am eljivaro (https://keybase.io/eljivaro) on keybase.
  • I have a public key ASBprxkgyacN203weamld536V3f13scc_-lGiDQsDHzV9wo

To claim this, I am signing this object: