Skip to content

Instantly share code, notes, and snippets.

View kaerer's full-sized avatar
🍀
Life goes on.

Erce Erözbek kaerer

🍀
Life goes on.
View GitHub Profile
@kaerer
kaerer / gist:104e549f892af6657dc9
Last active September 14, 2015 09:12
Centos 6 first steps - yii2
#centos 6~
sudo su
#- Repos
yum install epel-release
mkdir /root/repos
cd /root/repos
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
@kaerer
kaerer / AmazonS3Service.php
Created May 26, 2017 09:59
A simple Symfony Service to Upload Files to Amazon S3
<?php
namespace Acme\DemoBundle\Services;
use Aws\S3\S3Client;
/**
* Class AmazonS3Service
*
* @package Acme\DemoBundle\Service
*/
@kaerer
kaerer / haproxy.cfg
Created July 21, 2017 08:31
Here's a sample WORKING haproxy config for websockets / socketio. We were able to get socketio working on an Amazon ELB with just one node, but when we added multiple nodes, we saw weird client issues. So, we decided to use HAProxy on Ubuntu 12.04 and spent significant time trying to get just the right configuration (haproxy.cfg). Note though th…
global
#debug
#daemon
log 127.0.0.1 local0
defaults
log global
option httplog
frontend unsecured *:80
@kaerer
kaerer / simpleBenchmark.js
Last active November 15, 2017 09:55
JsBenchmark
var timer = function(name) {
var start = new Date();
return {
stop: function() {
var end = new Date();
var time = end.getTime() - start.getTime();
console.log('Timer:', name, 'finished in', time, 'ms');
}
}
};
@kaerer
kaerer / LuhnAlgorithmMethods.js
Created November 15, 2017 09:54
JsCreditCardChecker
#Luhn algorithm
function a(inputNum) {
var digit, digits, flag, sum, _i, _len;
flag = true;
sum = 0;
digits = (inputNum + '').split('').reverse();
for (_i = 0, _len = digits.length; _i < _len; _i++) {
digit = digits[_i];
digit = parseInt(digit, 10);
@kaerer
kaerer / traceport.sh
Created November 15, 2017 09:58
Dump all packages for selected port
#!/usr/bin/env bash
echo $1 | grep -E -q "^[0-9]+$" || (echo "Please specify a port number to listen to." ; exit 1)
PORT=$1
TCPDUMPARG="tcp port $PORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
sudo tcpdump -s 0 -A -i eth0 $TCPDUMPARG
#TCPDUMPARG="tcp port $PORT and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)"
@kaerer
kaerer / watch_memcached.sh
Created November 15, 2017 09:59
Watch memcache status
watch "(echo stats ; echo quit ) | nc 127.0.0.1 11211"
@kaerer
kaerer / random_strgenerator.php
Created January 31, 2018 14:30 — forked from irazasyed/random_strgenerator.php
PHP: Generate random string
/**
* Generate and return a random characters string
*
* Useful for generating passwords or hashes.
*
* The default string returned is 8 alphanumeric characters string.
*
* The type of string returned can be changed with the "type" parameter.
* Seven types are - by default - available: basic, alpha, alphanum, num, nozero, unique and md5.
*
@kaerer
kaerer / fb-open-graph.liquid
Created April 8, 2019 09:37 — forked from JefferyHus/fb-open-graph.liquid
Facebook Open Graph meta tags for Shopify. Add this as a snippet called "fb-open-graph.liquid" in your theme, and then add {% include 'fb-open-graph' %} to your theme.liquid file.
{% if template contains 'product' %}
<meta property="og:type" content="product">
<meta property="og:title" content="{{ product.title | strip_html | escape }}">
<meta property="og:category" content="{{ product.type }}" />
{% for image in product.images limit:3 %}
<meta property="og:image" content="http:{{ image.src | product_img_url: 'master' }}">
<meta property="og:image:secure_url" content="https:{{ image.src | product_img_url: 'master' }}">
{% endfor %}
<meta property="og:price:amount" content="{{ product.price | money_without_currency | stip_html | escape | remove: ',' }}">
<meta property="og:price:currency" content="{{ shop.currency }}">
@kaerer
kaerer / openssl.md
Created April 8, 2019 09:41 — forked from NoMan2000/openssl.md
Common OpenSSL Commands with Keys and Certificates

Common OpenSSL Commands with Keys and Certificates

SSL Info

Generate RSA private key with certificate in a single command

openssl req -x509 -newkey rsa:4096 -sha256 -keyout example.key -out example.crt -subj "/CN=example.com" -days 3650 -passout pass:foobar

Generate Certificate Signing Request (CSR) from private key with passphrase

openssl x509 -x509toreq -in example.crt -out example.csr -signkey example.key -passin pass:foobar