Skip to content

Instantly share code, notes, and snippets.

View sim642's full-sized avatar

Simmo Saan sim642

View GitHub Profile
@sim642
sim642 / reddit-sendbird.ts
Last active March 11, 2023 21:36
Reddit Chat (via SendBird) reverse engineering
import * as request from "request";
import * as SendBird from "sendbird";
const sendbirdServiceUrl = "https://sendbird.reddit.com";
const sendbirdAppId = "2515BDA8-9D3A-47CF-9325-330BC37ADA13";
const userId = "t2_mv8j9bt"; // chatrev1
const accessToken = "49777998329-oof4CSA1jedsnu6pXgJj_SFIk7o";
// accessToken (bearer):
// full (personalized) oauth2 access token (from web/installed reddit app): user id base 10 - oauth2 access token
@sim642
sim642 / aoc2018-day20-tree.txt
Created December 20, 2018 14:35
Advent of Code 2018 day 20 regex AST tree
.SWWNNWNNESENNWWNWSSWSWWWSEEEE
.|N
.|.SSWWSSESSSEENNESSEEEENENEEENWNWSWWWS
.|.|.WW
.|.|.|SEEWWN
.|.|.|
.|.|.NEN
.|.|.|.WWW
.|.|.|.|NN
.|.|.|.|.W
module SICPInfSeries where
-- SICP, exercise 3.59
integrateSeries :: Fractional a => [a] -> [a]
-- integrateSeries s = helper s 1
-- where helper (a:as) n = a / n : helper as (n + 1)
integrateSeries s = zipWith (/) s nats
where nats = 1 : map (+1) nats
expSeries :: Fractional a => [a]
@sim642
sim642 / newline.patch
Last active July 18, 2020 07:31
WeeChat WIP patch for rendering \n in messages
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 7fb229e88..c65db3302 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -1244,8 +1244,10 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
int read_marker_x, read_marker_y;
int word_start_offset, word_end_offset;
int word_length_with_spaces, word_length;
+ int num_split_lines, i;
char *message_with_tags, *message_with_search;
@sim642
sim642 / golomb.hs
Created June 3, 2021 15:57
Haskell Golomb sequence
golomb@(_:_:g) = 1 : 2 : 2 : concatMap (uncurry replicate) (zip g [3..])
-- golomb = 1 : 2 : g
-- where g = 2 : concatMap (uncurry replicate) (zip g [3..])