Skip to content

Instantly share code, notes, and snippets.

@yurynix
yurynix / index.js
Created July 18, 2017 15:24
Patch to @xmpp/plugins/starttls/index.js
'use strict'
const xml = require('@xmpp/xml')
const streamfeatures = require('../stream-features')
const tls = require('tls')
const net = require('net')
/*
* References
* https://xmpp.org/rfcs/rfc6120.html#tls
diff --git a/client/state/action-types.js b/client/state/action-types.js
index 04e4050de8..7e5219e66d 100644
--- a/client/state/action-types.js
+++ b/client/state/action-types.js
@@ -802,9 +802,8 @@ export const TIMEZONES_REQUEST_SUCCESS = 'TIMEZONES_REQUEST_SUCCESS';
export const TWO_FACTOR_AUTHENTICATION_LOGIN_REQUEST = 'TWO_FACTOR_AUTHENTICATION_LOGIN_REQUEST';
export const TWO_FACTOR_AUTHENTICATION_LOGIN_REQUEST_FAILURE = 'TWO_FACTOR_AUTHENTICATION_LOGIN_REQUEST_FAILURE';
export const TWO_FACTOR_AUTHENTICATION_LOGIN_REQUEST_SUCCESS = 'TWO_FACTOR_AUTHENTICATION_LOGIN_REQUEST_SUCCESS';
-export const TWO_FACTOR_AUTHENTICATION_PUSH_POLL_COMPLETED = 'TWO_FACTOR_AUTHENTICATION_PUSH_POLL_COMPLETED';
-export const TWO_FACTOR_AUTHENTICATION_PUSH_POLL_START = 'TWO_FACTOR_AUTHENTICATION_PUSH_POLL_START';
@yurynix
yurynix / INSTALL.md
Created March 7, 2018 10:46
Install phpcs
brew tap homebrew/homebrew-php
brew install composer
composer global require "squizlabs/php_codesniffer=*"
composer global require wp-coding-standards/wpcs

Add to .zshrc:

export PATH=~/.composer/vendor/wp-coding-standards/wpcs:~/.composer/vendor/squizlabs/php_codesniffer/bin:$PATH
@yurynix
yurynix / get-process-with-intofiy-handles.js
Last active November 26, 2018 12:55
Get process with their inotify handles and watches counts
// based on https://unix.stackexchange.com/questions/15509/whos-consuming-my-inotify-resources/426001#426001
const fs = require('fs');
const { promisify } = require('util');
const readdirAsync = promisify(fs.readdir);
const readFileAsync = promisify(fs.readFile);
const readlinkAsync = promisify(fs.readlink);
(async function () {
if (process.platform !== 'linux') {
@yurynix
yurynix / Create_ROOT_CA.md
Last active June 25, 2019 07:53
Create root CA

Create a certificate authority for dev purposes

This instructions allow you to create a root Certificate Authority and issue a certificate to "localhost", to improve local development expirience. Those instrusctions assume you use macOS

  1. create a root CA
  2. create certificate
  3. sign the certificate with root CA we created at (1)
  4. add root CA to the keychain via security
const child_process = require('child_process');
const util = require('util');
const fs = require('fs');
const readfile = util.promisify(fs.readFile);
const readdir = util.promisify(fs.readdir);
const readlink = util.promisify(fs.readlink);
async function getRunningPids(): Promise<number[]> {
const files = await readdir(`/proc`);
@yurynix
yurynix / os-stats.js
Created February 13, 2020 10:27
Some useful stats from the proc filesystem
const util = require('util');
const fs = require('fs');
const readfile = util.promisify(fs.readFile);
const readdir = util.promisify(fs.readdir);
const readlink = util.promisify(fs.readlink);
const stat = util.promisify(fs.stat);
async function getProcessRSSMemory(pid) {
try {
@yurynix
yurynix / console-log.js
Last active February 25, 2020 18:17
Blogpost
console.log(await exec('du -h / 2>&1 | grep -v "Permission denied"'));
console.log('Open FDs:', JSON.stringify(await getAllProcessFds()));
try {
await downloadAndExtract(…);
} catch (ex) {
const errorMessage = ex.message;
if (errorMessage.indexOf('ENOSPC') > -1) {
console.log('Got ENOSPC! Check out df output:\n', await exec('df -h'));
}
throw ex;
}