Skip to content

Instantly share code, notes, and snippets.

@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 / 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
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 / 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
{
"name": "test",
"version": "1.0.0",
"description": "test",
"scripts": {
"build": "cross-env NODE_ENV=production webpack --env.prod=true --config webpack.config.js --progress --colors",
"start": "webpack-dev-server",
"prod": "cross-env NODE_ENV=production webpack-dev-server --env.prod=true",
"test": "cross-env NODE_PATH=.:app jest --maxWorkers=4",
"lint": "eslint ./src ./webpack.config.js -f table || true"
////////////
///
/// Delphin with RegExp x 131,568 ops/sec ±1.01% (85 runs sampled)
/// Delphin with for loop x 15,235 ops/sec ±0.72% (90 runs sampled)
/// Delphin with regex replace x 291,946 ops/sec ±1.08% (88 runs sampled)
/// Calypso x 323,048 ops/sec ±1.51% (87 runs sampled)
/// Fastest is Calypso
///
////////////
// External dependencies
import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
// Internal dependencies
import styles from './styles.scss';
import Input from './input';
const wrapInputChildRecursivly = refSaver => {
const recurser = child => {
@yurynix
yurynix / actions.js
Created April 21, 2016 16:55
coomments polling
/**
* Internal dependencies
*/
import wpcom from 'lib/wp';
import {
COMMENTS_RECEIVE,
COMMENTS_COUNT_RECEIVE,
COMMENTS_REQUEST,
COMMENTS_REQUEST_SUCCESS,
COMMENTS_REQUEST_FAILURE,
#include <stdio.h>
#include <sys/time.h> /* select */
#include <sys/types.h> /* select */
#include <unistd.h> /* select, exit */
#include <stdlib.h> /* atexit */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pcap.h>
@yurynix
yurynix / tlushim-summary.js
Last active January 31, 2016 10:28
tlushim.co.il hours summary
var hours = [];
totalMinutes = 0,
maxMinutes = 0;
minMinutes = Number.MAX_VALUE;
Array.prototype.forEach.call(document.querySelectorAll('table.atnd > tbody > tr'), function (tr) {
// if there is an error td, then don't count that row
var errorTd = tr.querySelectorAll('td.atnd_error');
if (errorTd && errorTd.length > 0) {