Skip to content

Instantly share code, notes, and snippets.

@lynx-r
lynx-r / performance test for\map\reduce.js
Last active August 15, 2023 11:53
A simple performance test of for/map/reduce
function arrayEquals(a, b) {
return (
Array.isArray(a) &&
Array.isArray(b) &&
a.length === b.length &&
a.every((val, index) => val === b[index])
);
}
const LENGTH = 1000;
@lynx-r
lynx-r / proxy.pac
Created September 9, 2022 08:53 — forked from dusenberrymw/proxy.pac
Proxy PAC file template for selective SSH SOCKS proxies, plus a [re]installation script.
// Proxy PAC File
// - Used to redirect certain addresses to the server through the SOCKS ssh port (1280 for this file), i.e.
// tunnel traffic through server.
// - Useful for easily accessing webpages from services running on a server (Jupyter notebooks, TensorBoard, Spark UI, etc.)
// that is otherwise locked down by a firewall.
// - To install on OS X/MacOS, go to "Settings->Network->Advanced->Proxies->Automatic Proxy Configuration"
// and paste the local file url (`file:///absolute/path/to/proxy.pac`).
// - Alternatively, use `./reinstall_proxy.sh`.
// - SSH to the server with `ssh -D 1280 ....`.
function FindProxyForURL(url, host) {
Host remote-server
HostName remote-server.local
User aleksey
IdentityFile ~/.ssh/remote-server
# для доступа через 443 порт в браузере с помощью плагина SwitchyOmega
DynamicForward localhost:9090
# для доступа к 3010 порту из виртуальной машины (Vagrant), на удаленном remote-server, хост-машине
RemoteForward 192.168.33.10:3010 localhost:3010
# для доступа на localhost хост-машины портов 3002, 3006 и т.д. из вирутальной машины (Vagrant),
# удаленного remote-server
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/.bin:$HOME/.yarn/bin:$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/frontender/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@lynx-r
lynx-r / killonport
Last active March 18, 2021 09:36
zsh script for killing a listening process on a specified port
#!/bin/zsh
function help() {
echo "usage: killonport port"
echo "-f don't ask before killing"
echo "-h help"
}
function killListenerOnPort() {
# get script options
@lynx-r
lynx-r / gist:ec7ea97578a622bc21cc5fbe96178b3e
Created November 19, 2020 06:37
Скрипт получения данных из СКПДИ
<?php
$test = 0;
$username = "";
$password = "";
//$schema_skpdi = "skpdi";
$schema_skpdi = "dtp_global_stat";
include('includes/Unirest.php');
include('includes/pdb.php');
APIMethodGet:
Type: AWS::ApiGateway::Method
Properties:
ApiKeyRequired: false
HttpMethod: GET
Integration:
ContentHandling: CONVERT_TO_TEXT
CacheKeyParameters: []
Uri: !Join
- ':'
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.workingbit</groupId>
<artifactId>account-service-test-ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@lynx-r
lynx-r / layout.html
Created June 16, 2017 08:53
layouts/layout.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<title>Hello Spring Boot!</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="http://cdn.jsdelivr.net/webjars/bootstrap/3.3.6/css/bootstrap.min.css"
th:href="@{/webjars/bootstrap/3.3.6/css/bootstrap.min.css}"
rel="stylesheet" media="screen"/>
@lynx-r
lynx-r / index.html
Created June 16, 2017 08:52
index.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layouts/layout}">
<head>
<title>Hello Spring Boot!</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="http://cdn.jsdelivr.net/webjars/bootstrap/3.3.6/css/bootstrap.min.css"
th:href="@{/webjars/bootstrap/3.3.6/css/bootstrap.min.css}" rel="stylesheet" media="screen"/>
<link href="../static/css/core.css" th:href="@{/css/core.css}" rel="stylesheet" media="screen"/>
<script src="http://cdn.jsdelivr.net/webjars/jquery/2.2.1/jquery.min.js"