Skip to content

Instantly share code, notes, and snippets.

View tomfun's full-sized avatar

Greg tomfun

  • itrdev
  • ukraine
View GitHub Profile
@tomfun
tomfun / RestAttributeController.php
Created July 11, 2015 18:13
doctrine sql log on screen
$this->em->getConnection()
->getConfiguration()
->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger())
;
//StreamBuffer.php (260..261)
//vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
//_establishSocketConnection
$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;
@tomfun
tomfun / gen.sh
Created September 4, 2015 10:30
generate ssl certificate/wildcard
#!/usr/bin/env bash
# https://serversforhackers.com/self-signed-ssl-certificates
# http://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate
# Specify where we will install
# the xip.io certificate
SSL_DIR="/home/tomfun/prj/ssl/o.o"
SSL_FILE="o.o"
# Set the wildcarded domain
# we want to use
DOMAIN="*.o.o"
@tomfun
tomfun / visudo
Created September 14, 2015 09:53
allow sudo for user liberulo without password
liberulo ALL=NOPASSWD:ALL
@tomfun
tomfun / geoFilterDiscretteCache.js
Last active February 22, 2016 14:04
rough location filter with same minimum/maximum lattitude/longitude range
"use strict";
const EARTH_RADIUS = 6371;
function degToRad(deg) {
return deg * Math.PI / 180;
}
/**
* @param {Number} distance km
* @returns {Number}
@tomfun
tomfun / nodejs-tcp-example.js
Last active February 25, 2016 18:01 — forked from tedmiston/nodejs-tcp-example.js
Node.js tcp client and server example
/**
env SERVER=1 node 3.js
http://joxi.ru/n2YYBPdcjnbK42
http://joxi.ru/DmB74bJFN8JoB2
*/
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
@tomfun
tomfun / gen_new_client.sh
Last active June 7, 2023 14:38
how to: tls client nginx
#!/bin/sh
echo $1
echo "optional questions is: A challenge password, An optional company name, Enter Export Password, Enter Import Password"
mkdir -p client/$1
# Create the Client Key and CSR
# личный ключ клиента, только ему самому стоит его знать. если софт поддерживает пассфраз (как ниже), лучше его использовать.
openssl genrsa -des3 -out client/$1/key.key 2048
@tomfun
tomfun / rfc.md
Last active July 7, 2016 12:16
how to be with frontend dependencies

Предложение к разработке новых продуктов внутри custom отдела

Глоссарий

bundle - пакет/библиотека содержащая в себе ресурсы и код для бекенда и фронтенда. у бандла обязательно есть версия, он ставится через пакетный менеджер.

бекенд - часть бизнес логики связанная с обработкой и хранением информации выполняемая на сервере.

фронтенд - часть бизнес логики завязанная на информацию предоставляющуся бекендом

@tomfun
tomfun / 1.js
Last active August 8, 2016 09:23
/*
```bash
npm i big-integer
```
*/
// const input = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,];
// const input = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,];
const input = [2, 3, 5, 7, 11, 13];
// const input = [2, 3, 5, 7, 11];
// const input = [2, 3, 5, 7];
@tomfun
tomfun / 1.html
Created August 19, 2016 11:30
в случае еденичного (не кешируемого) запроса к дом, выигрывает одиночный вызов. такие ситуации на самом деле бывают очень часто, часто нужно сделать что-то единоразово в первую загрузку страницы. в остальном же, разумеется лучше использовать некий el для удобной работы.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<title>Test selectors</title>
<link href="style.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>