Skip to content

Instantly share code, notes, and snippets.

View Orphist's full-sized avatar
🏠
Working from home

Max Surkov Orphist

🏠
Working from home
View GitHub Profile
@Orphist
Orphist / turing.json
Created October 7, 2023 07:21 — forked from dipu-bd/turing.json
JSON schema for a Turing complete machine
{
"$schema": "http://json-schema.org/schema",
"title": "JSON schema for a turing complete machine",
"type": "object",
"definitions": {
"statement": {
"description": "",
"type": "object",
@Orphist
Orphist / java_download.sh
Created August 8, 2023 04:01 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@Orphist
Orphist / multi.rb
Created April 25, 2023 18:47 — forked from davidbalbert/multi.rb
Generic functions in Ruby
# Generic functions in Ruby
#
# How to use it:
#
# plus = Multi.new
# plus.add_method(Numeric, Numeric) { |a, bi| a + b }
# plus.call(1, 2) #=> 3
#
# For some more fun:
#

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@Orphist
Orphist / gist:f2116e51bbf3e55fe1b437b0311bacee
Created January 19, 2023 15:05 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@Orphist
Orphist / install-node-js.sh
Created November 5, 2021 19:45 — forked from ankurk91/install-node-js.sh
Install node-js, npm and yarn on Ubuntu/Mac using nvm
#!/bin/sh
# Install node and npm via nvm - https://github.com/nvm-sh/nvm
# Run this script like - bash script-name.sh
# Define versions
INSTALL_NODE_VER=14
INSTALL_NVM_VER=0.39.0
@Orphist
Orphist / howto.md
Created September 26, 2021 18:30 — forked from NikolayS/howto.md
log_min_duration_statement = 0 and I/O impact

How to get an estimate of the impact of writing Postgres logs with log_min_duration_statement = 0:

  1. Do select pg_stat_statements_reset(); and wait N seconds (where N >> 60 – say 1-24 hours, covering typical busy hours). Remember when it was, and write down somewhere – this timestamp will be needed!

  2. Check if select count(*) from pg_stat_statements is lower than pg_stat_statements.max. If it's equal to it, then raise pg_stat_statements.max and restart with the step 1.

  3. Get the estimate:

\set TS_PGSS_RESET 'XXXX-XX-XX XX:XX:XX';
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Orphist
Orphist / dfs-bfs-non-recursive.js
Created September 16, 2019 06:57 — forked from DmitrySoshnikov/dfs-bfs-non-recursive.js
Non-recursive DFS and BFS algorithms
/**
* Depth-first and Breadth-first graph traversals.
*
* In this diff we implement non-recursive algorithms for DFS,
* and BFS maintaining an explicit stack and a queue.
*
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
* MIT Style license
*/