Skip to content

Instantly share code, notes, and snippets.

View moshensky's full-sized avatar

Nikita Moshensky moshensky

  • Actyx AG
  • Sofia, Bulgaria
View GitHub Profile
@moshensky
moshensky / gist:9ca7a43c587bf3e490754baa8a76e3a4
Created October 4, 2023 12:24 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@moshensky
moshensky / README.md
Created December 28, 2022 16:43 — forked from valyala/README.md
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:

Keybase proof

I hereby claim:

  • I am moshensky on github.
  • I am moshensky (https://keybase.io/moshensky) on keybase.
  • I have a public key ASCPhmGATjC_jZt3mqoru0g4U85EjNGqpzPImYMKdtRvzAo

To claim this, I am signing this object:

@moshensky
moshensky / flat-aray.js
Created March 13, 2017 21:07
Flat an array of arbitrarily nested arrays into a flat array (ES6)
function flatten(arr, accumulator = []) {
if (arr.length === 0) {
return accumulator;
}
const [head, ...tail] = arr;
if (!Array.isArray(head)) {
return flatten(tail, accumulator.concat(head));
}
@moshensky
moshensky / upgrade-postgres-9.3-to-9.5.md
Created August 28, 2016 11:41 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
@moshensky
moshensky / API.md
Created June 2, 2016 12:49 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@moshensky
moshensky / nutjob-webhostbuilder-pattern.cs
Created May 31, 2016 07:57 — forked from guardrex/nutjob-webhostbuilder-pattern.cs
My "NUTJOB" WebHostBuilder Pattern
/*
The purpose of this pattern is to consolidate all application
configuration into just ONE file and configure the app based
on the server/dev environment where it finds itself. It removes
the need for environment variables and/or JSON config files on
individual machines.
*/
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
@moshensky
moshensky / on-jsx.markdown
Created March 21, 2016 05:04 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'

@moshensky
moshensky / PDFlowStream.java
Created January 24, 2016 21:57 — forked from ecmel/PDFlowStream.java
PDFBox 2 Text Helper
package portal.core;
import java.awt.Color;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
jspm install aurelia-validation
Updating registry cache...
Looking up github:aurelia/validation
Looking up github:aurelia/templating
Looking up github:aurelia/binding
Looking up github:aurelia/dependency-injection
Looking up npm:core-js
Downloading npm:core-js@0.9.6
Looking up github:aurelia/loader
Looking up github:aurelia/html-template-element