Skip to content

Instantly share code, notes, and snippets.

View exu's full-sized avatar
🔨
forging testkube

Jacek Wysocki exu

🔨
forging testkube
View GitHub Profile
rate := time.Second / 10 // 10 requests a second
limit := time.Tick(rate)
for req := range messages {
<-limit
go makeRequest(req)
}
@exu
exu / sysctl.conf
Created November 3, 2016 05:09 — forked from kgriffs/sysctl.conf
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
# Protection from SYN flood attack.
net.ipv4.tcp_syncookies = 1
@exu
exu / reflection.go
Created August 9, 2016 07:42 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
Authenticate with GitHub to increase your rate limit and allow you
to pull from private repositories. To do that, add the following
entry to your ~/.netrc file:
machine api.github.com
login <username>
password <token>
@exu
exu / .jshintrc
Last active August 29, 2015 13:56 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
#!/usr/bin/env php
<?php
$namespace = 'DE';
//I want to generate deafult bundle
`php app/console generate:bundle --namespace={$namespace}/AppBundle --bundle-name=AppBundle --no-interaction --dir=src/`;
`rm -rf src/Acme`;
`rm -rf web/bundles/acmedemo`;
/**
* @Rest\View()
* @ParamConverter("partner", class="AppBundle:Partner")
*/
public function getAction(Partner $id)
{
$view = $this->view($id);
return $this->handleView($view);
}
@exu
exu / ajaxexample.html.twig
Last active December 18, 2015 16:49
example how to load different layouts depending on request type
{% extends app.request.xmlHttpRequest
? '::ajax-layout.html.twig'
: '::full-layout.html.twig' %}
/**
* @When /^I check "([^"]*)" if not checked yet$/
*/
public function iCheckIfNotCheckedYet($id)
{
$Page = $this->getSession()->getPage();
$isChecked = $Page->find('css', 'input[type="checkbox"]:checked#' . $id);
if (!$isChecked) {
$Page->find('css', '#' . $id)->click();
}