Skip to content

Instantly share code, notes, and snippets.

@thmsobrmlr
thmsobrmlr / setup.sql
Created November 8, 2023 11:53
Can we use the CH PostgreSQL table engine to query posthog_persondistinctids?
DROP TABLE default.poc_pg_persondistinctid;
CREATE TABLE default.poc_pg_persondistinctid
(
id UInt32,
distinct_id String,
version UInt64,
person_id UInt32,
team_id UInt32
)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
SELECT uuid,
event,
properties,
timestamp,
team_id,
distinct_id,
elements_chain,
created_at
FROM events
WHERE team_id = 2
@thmsobrmlr
thmsobrmlr / Dockerfile
Created December 14, 2022 14:14
Only prod node dependencies in docker image
FROM node:16-alpine AS deps
RUN apk --no-cache add curl
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
WORKDIR /usr/src/app
COPY ["package.json", "yarn.lock", "./"]
# build-dependencies are required for bcrypt on m1 macs
RUN apk --no-cache --virtual build-dependencies add python3 make g++ \
&& yarn install --production \
&& apk del build-dependencies
RUN /usr/local/bin/node-prune
@thmsobrmlr
thmsobrmlr / HOTFIX_DEPENDENCY.md
Created May 12, 2022 07:21
How to fork a dependency and use it locally in a project
@thmsobrmlr
thmsobrmlr / update-global-npm-and-yarn-packages.md
Created May 5, 2022 07:57
How to update global yarn and npm packages

NPM

List globally installed npm packages

npm list -g --depth=0

Update globally installed npm packages

npm i npm-check -g # install npm-check

npm-check -gu # list packages that need to be updated

@thmsobrmlr
thmsobrmlr / removeAppNameFromProductTitle.test.ts
Created February 12, 2022 16:07
Remove the app name for product titles for Google Play In-App-Purchases
import removeAppNameFromProductTitle from './removeAppNameFromProductTitle';
describe('removeAppNameFromProductTitle', () => {
it('returns title without app name', () => {
const title = 'my test';
const result = removeAppNameFromProductTitle(title);
expect(result).toEqual('my test');
});
@thmsobrmlr
thmsobrmlr / transaction.test.ts
Created June 6, 2021 22:10
Using mongodb transactions with typegoose
import mongoose from "mongoose";
import { prop as Property, getModelForClass } from "@typegoose/typegoose";
import { withTransaction } from "./transaction";
class Foo {
@Property({ required: true })
example!: string;
}
const FooModel = getModelForClass(Foo);
@thmsobrmlr
thmsobrmlr / confluence_pdf.css
Created July 26, 2019 12:50
Confluence Export PDF Custom Style
@page {
size: 210mm 297mm; /* A4-sized pages in portrait orientation; default is US letter */
margin-top: 2.54cm;
margin-bottom: 2.54cm;
margin-left: 1.27cm;
margin-right: 1.27cm;
}
body,p,li,td,table,tr,.bodytext,.stepfield {
font-size: 15px;
@thmsobrmlr
thmsobrmlr / result.txt
Created October 9, 2018 13:36
$ sudo tcpdump -i any -n host 1.1.1.1 and port 53
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
15:29:42.444866 IP 192.168.188.44.60620 > 1.1.1.1.53: 45006+ A? auth.otc.t-systems.com. (40)
15:29:46.660608 IP 1.1.1.1.53 > 192.168.188.44.60620: 45006 ServFail 0/0/0 (40)
15:29:54.959125 IP 192.168.188.44.59598 > 1.1.1.1.53: 42927+ A? serverfault.com. (33)
15:29:54.975230 IP 1.1.1.1.53 > 192.168.188.44.59598: 42927 4/0/0 A 151.101.193.69, A 151.101.1.69, A 151.101.65.69, A 151.101.129.69 (97)