Skip to content

Instantly share code, notes, and snippets.

View netwood's full-sized avatar
🚀
Working from space :)

Igor Korsakov netwood

🚀
Working from space :)
View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active October 15, 2025 13:41
Listen to your web pages

Procedure for Mongodb Logrotate

The default install for Mongodb does not configure log rotation.

In /etc/logrotate.d/mongod

/var/log/mongodb/*.log {
    daily
    rotate 30
    compress

dateext

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@MaxPleaner
MaxPleaner / times.coffee
Last active January 27, 2017 15:57 — forked from FGRibreau/times.js
Ruby .times & .upto & .downto methods in Coffeescript
# Ruby = 5.times { |i| puts i }
# Coffee = (1).times (i) -> console.log i
Number.prototype.times = (cb) ->
i = -1;
while (++i < this) then cb(i)
+this
# Ruby = 1.upto(5) { |i| puts i }
# Coffee = (1).upto 5, (i) -> console.log i
Number.prototype.upto = (t, cb) ->
@mikberg
mikberg / connection.js
Last active December 29, 2021 16:57
MongoDB connection with async/await
import { MongoClient } from 'mongodb';
import promisify from 'es6-promisify';
let _connection;
const connect = () => {
if (!process.env.MONGO_CONNECTION_STRING) {
throw new Error(`Environment variable MONGO_CONNECTION_STRING must be set to use API.`);
}
@mrmlnc
mrmlnc / electron-api.md
Last active August 25, 2023 07:23
Electron API

Базовые возможности

process — это объект, позволяющий получить информацию о типе запущенного процесса (рендеринг или основной процесс), версию Chrome и Electron, а также путь до выполняемого js-файла.

Пользовательские элементы DOM:

Объект File — это абстракция над нативным File, передающая стандартному HTML5 file API путь к физическому расположению файла в файловой системе пользователя.

@ethers
ethers / call-then-sendtx-pattern.js
Last active July 24, 2020 05:51
call-then-sendtx pattern for Ethereum Dapps
/*
In Ethereum, a contract can be written so that it returns a value for eth_call.
A Dapp can then check for success or error value of eth_call, before calling eth_sendTransaction,
to take advantage of eth_call effectively being a "preview" of the code flow that the transaction
will take. In traditional client-server, clients can't ask servers beforehand what's going to
happen when the client makes a call; with Dapps contracts can be written so that clients can ask
for a "preview" of what is going to happen, before any funds/ethers are actually utilized
(eth_call does not cost any ethers).
Note: it is possible that in between eth_call and when eth_sendTransaction is actually mined,
@EdwardBetts
EdwardBetts / pprint_color.py
Last active March 28, 2025 10:12
Python pprint with color syntax highlighting for the console
from pprint import pformat
from typing import Any
from pygments import highlight
from pygments.formatters import Terminal256Formatter
from pygments.lexers import PythonLexer
def pprint_color(obj: Any) -> None:
"""Pretty-print in color."""
@netwood
netwood / cdn.conf
Last active August 29, 2015 14:06 — forked from tx2z/cdn.conf
# -------------------------------------------------
# CDN CONFIGURATION
# -------------------------------------------------
# Show "Not Found" 404 errors in place of other NGINX errors
error_page 403 /404;
error_page 404 /404;
error_page 405 /404;
error_page 500 501 502 503 504 /404;
location /404 {
@LeCoupa
LeCoupa / meteor-mongo-oplog-ubuntu.bash
Last active February 27, 2020 05:54
Meteor: Set up Oplog Tailing on Ubuntu --> https://github.com/LeCoupa/awesome-cheatsheets
# How to set up Oplog Tailing on your Meteor application on Ubuntu. (production environment)
# We are going to create a replica set with only one member (the primary) so as to benefit from oplog tailing.
# More: https://github.com/meteor/meteor/wiki/Oplog-Observe-Driver
# 1. Stop MongoDB
$ sudo service mongodb stop