Skip to content

Instantly share code, notes, and snippets.

Karel Wintersky KarelWintersky

  • St.Peterburg
Block or report user

Report or block KarelWintersky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@odan
odan / openssl_encrypt_decrypt.md
Last active Mar 22, 2019
Replace mcrypt_encrypt with openssl_encrypt
@ssokolow
ssokolow / firefox_migration.rst
Last active Feb 25, 2019
Disaster Plans for Firefox XUL Sunset
View firefox_migration.rst

Disaster Plans for Firefox XUL Sunset

Public URL:Github Gist
Status: Incomplete
Last Updated:2018-08-23 04:10 EDT

Threat Summary

@kissarat
kissarat / descend.sql
Created Jun 16, 2015
MySQL. Gets all descendants (children) for given ID of parent with depth parameter
View descend.sql
DROP PROCEDURE IF EXISTS descend;
CREATE PROCEDURE descend(uid INT, depth INT) BEGIN
DROP TABLE IF EXISTS descendants;
DROP TABLE IF EXISTS children;
CREATE TEMPORARY TABLE descendants (
id int,
parent_id int,
level int
) ENGINE = MEMORY;
INSERT INTO descendants(id, level)
View Mabdelbrot.java
// by Erik Wrenholt
import java.util.*;
class Mandelbrot
{
static int BAILOUT = 16;
static int MAX_ITERATIONS = 1000;
private static int iterate(float x, float y)
{
@silverslice
silverslice / DbMysql.php
Last active Aug 29, 2015
Mysql wrapper for legacy projects
View DbMysql.php
<?php
/**
* Подключение к БД
*
* @param $host
* @param $user
* @param $pass
* @param $db
* @return bool|resource
*/
View jff-csv.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace strings2csv
{
static class CSV
{
@prwhite
prwhite / Makefile
Last active Aug 15, 2019
Add a help target to a Makefile that will allow all targets to be self documenting
View Makefile
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@CrocoDillon
CrocoDillon / _blank.js
Last active May 13, 2019
Automatically open external links in new tab or window.
View _blank.js
// vanilla JavaScript
var links = document.links;
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
}
}
// or in jQuery
@1Franck
1Franck / json_clean_decode.php
Last active Apr 11, 2019
Clean comments of json content and decode it with json_decode(). Work like the original php json_decode() function with the same params. Support comments like /* */ and //
View json_clean_decode.php
<?php
/**
* Clean comments of json content and decode it with json_decode().
* Work like the original php json_decode() function with the same params
*
* @param string $json The json string being decoded
* @param bool $assoc When TRUE, returned objects will be converted into associative arrays.
* @param integer $depth User specified recursion depth. (>=5.3)
* @param integer $options Bitmask of JSON decode options. (>=5.4)
* @return array/object
@samarpanda
samarpanda / gist:4125105
Last active Jul 30, 2019
Test your php code execution time and Memory usage
View gist:4125105
<?php
// from http://php.net/manual/en/function.filesize.php
function formatBytes($bytes, $precision = 2) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
You can’t perform that action at this time.