Skip to content

Instantly share code, notes, and snippets.

View roma-glushko's full-sized avatar
🦁
Hacking my way to the promised land

Roman Glushko roma-glushko

🦁
Hacking my way to the promised land
View GitHub Profile
@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@fmasanori
fmasanori / Reddit Client Python 2.py
Last active April 21, 2019 08:12
Python Reddit Client
import json
import urllib
url = 'http://www.reddit.com/r/Python/.json'
resp = urllib.urlopen(url).read()
parsed = json.loads(resp)
for item in parsed['data']['children']:
doc = item['data']
@kenshinx
kenshinx / client.go
Last active February 3, 2024 18:49
golang socket server & client ping-pong demo
package main
import (
"os"
"log"
"net"
"strconv"
"strings"
)
@IvanChepurnyi
IvanChepurnyi / config.xml
Created November 5, 2013 09:37
Disable Mage_Log module observers
<config>
<frontend>
<controller_action_predispatch>
<observers>
<log>
<type>disabled</type>
</log>
</observers>
</controller_action_predispatch>
<controller_action_postdispatch>
@IvanChepurnyi
IvanChepurnyi / config.xml
Created November 5, 2013 09:41
Disable Mage_Reports module
<config>
<frontend>
<catalog_product_compare_remove_product>
<observers>
<reports>
<type>disabled</type>
</reports>
</observers>
</catalog_product_compare_remove_product>
<customer_login>
@jakubboucek
jakubboucek / format_html.php
Last active September 17, 2020 09:29
Format HTML source in PHP
<?php
$path = isset($argv[1]) ? $argv[1] : __DIR__;
$realpath = realpath($path);
echo "Thit tool is using free online formatter at www.freeformatter.com\n\n";
return HtmlFormatter::processObject($realpath);
/**
* Class HtmlFormatter
@rogyar
rogyar / cache-warmup.sh
Created April 10, 2016 10:52
Cache Warmup
wget -O - dev.mage2.com:1005/sitemap-1-1.xml | grep -E -o '<loc>.*</loc>' | sed -e 's/<loc>//g' -e 's/<\/loc>//g' > ~/sitemaps/mage2.txt
sudo siege -c100 -d5 -r1 -v -i -f ~/sitemaps/mage2.txt
@kn9ts
kn9ts / GPLv3.md
Last active July 14, 2024 10:46
GPLv3 explained

GPL3 LICENSE SYNOPSIS

TL;DR* Here's what the license entails:

1. Anyone can copy, modify and distribute this software.
2. You have to include the license and copyright notice with each and every distribution.
3. You can use this software privately.
4. You can use this software for commercial purposes.
5. If you dare build your business solely from this code, you risk open-sourcing the whole code base.
@IvanChepurnyi
IvanChepurnyi / test.php
Created September 8, 2016 14:38
Sample counter server in ReactPHP
<?php
require 'vendor/autoload.php';
$counter = new stdClass();
$counter->counter = 100000;
$counter->requests = 0;
$app = function ($request, $response) use ($counter) {
if ($request->getPath() === '/favicon.ico') {