Skip to content

Instantly share code, notes, and snippets.

View CharlesSOo's full-sized avatar

Charles So CharlesSOo

View GitHub Profile
@momentmaker
momentmaker / share.md
Last active April 21, 2025 10:02
sharing interesting links

health

wellnessfx - Improve health, fitness, wellness through blood tests, doctors, nutrition

driphydration - Drip Hydration Mobile IV Therapy | NAD, Dehydration, Hangover, Flu, Myers Cocktail

elysiumhealth - Breakthroughs in aging research are no longer a myth of science fiction but scientific fact. Elysium makes first-of-their-kind health products and technologies backed by partnerships with institutions at the forefront of aging research.

obasan - Obasan Mattress

@arthurgousset
arthurgousset / _lessons-on-operating-in-a-downturn.md
Last active June 27, 2024 06:09
💡 Lessons on operating in a downturn
@talegift
talegift / calculateUniswapTWAP.js
Created November 17, 2020 16:59 — forked from l3wi/calculateUniswapTWAP.js
Off-chain Uniswap V2 TWAP calculator in Javascript
import { ethers } from 'ethers'
// To use this you need to read the Uniswap v2 contract for a pair/
// PRICE pulled from priceXCumulativeLast
// TIMESTAMPS pulled from _blockTimestampLast in getReserves()
// Mock Data
// In a real scenario you would fetch and store price & timestamp at an interval
// to mirror the contract calculating the TWAP on chain
const price0 = '529527205677379158060966860839'
@ih2502mk
ih2502mk / list.md
Last active April 28, 2025 20:23
Quantopian Lectures Saved

I am testing Postgres insertion performance. I have a table with one column with number as its data type. There is an index on it as well. I filled the database up using this query:

insert into aNumber (id) values (564),(43536),(34560) ...

I inserted 4 million rows very quickly 10,000 at a time with the query above. After the database reached 6 million rows performance drastically declined to 1 Million rows every 15 min. Is there any trick to increase insertion performance? I need optimal insertion performance on this project. Using Windows 7 Pro on a machine with 5 GB RAM.

@sebastianwebber
sebastianwebber / benchmarks.sh
Last active March 17, 2023 14:33
Run benchmarks on postgres with pgbench
#!/bin/bash -ex
export PGBIN=/usr/pgsql-9.3/bin
export PGUSER=postgres
export PGDATABASE=bench
export DATADIR=/dados/pgbench
export CLUSTER_LOG=/tmp/benchmark.log
export TOTAL_CPUS=$(grep 'cpu cores' /proc/cpuinfo | uniq | awk '{print $NF}')
@ahopkins
ahopkins / # Sanic websocket feeds v2.md
Last active September 19, 2024 11:54
Sanic based websocket pubsub feed

Sanic Websockets Feeds v2

This is an outdated version

See latest

(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter42337284 = new Ya.Metrika({
id:42337284,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
@valyala
valyala / README.md
Last active March 20, 2025 08:44
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@Humoud
Humoud / regex-arabic.md
Last active March 21, 2025 00:55
Detecting arabic characters with regex.

Detect all Arabic Characters:

/[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufbc1]|[\ufbd3-\ufd3f]|[\ufd50-\ufd8f]|[\ufd92-\ufdc7]|[\ufe70-\ufefc]|[\uFDF0-\uFDFD]/

Summary:

  Arabic (0600—06FF, 225 characters)

  Arabic Supplement (0750—077F, 48 characters)