Skip to content

Instantly share code, notes, and snippets.

View douglaslise's full-sized avatar

Douglas Lise douglaslise

  • Porto Alegre, Brazil
View GitHub Profile
@mateusnava
mateusnava / memory_leak_analyzer.rb
Last active August 16, 2019 13:42
Memory Leak Analyzer
#########################################################################################################
# Dependencies: rbtrace (https://github.com/tmm1/rbtrace) in the ruby process that will be analyzed #
# Reference: https://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby #
#########################################################################################################
require 'json'
class MemoryLeakAnalyzer
attr_reader :filename
def initialize
@jeromedalbert
jeromedalbert / .gitattributes
Last active March 3, 2024 12:18
Automatically resolve Git merge conflicts in Rails schema.rb by picking the most recent date in the conflict (now works with Rails 5 and recent versions of Git). The following files should be in your home ~ directory. Inspired by https://tbaggery.com/2010/10/24/reduce-your-rails-schema-conflicts.html
db/schema.rb merge=railsschema
[server]
SERVER
[server:vars]
server_name=SERVER
email=noc@gopractice.io
docker_nginx_ssl=true
@fmorato
fmorato / clone_bitbucket_repos.py
Created April 9, 2017 06:21
Clone all repos from Bitbucket user or team
#!/usr/bin/env python3
'''
Clone all repos from Bitbucket user or team
It assumes you have 'git' and/or 'hg' in your path
usage: clone_bitbucket_repos.py user --login you@example.com
'''
import argparse
import getpass
@rosenfeld
rosenfeld / thread-pool.rb
Created June 7, 2016 12:49
Simple thread pool implementation in Ruby
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays
class ThreadPool
def initialize(max_threads = 10)
@pool = SizedQueue.new(max_threads)
max_threads.times{ @pool << 1 }
@mutex = Mutex.new
@running_threads = []
end
@douglaslise
douglaslise / native_js_drag_and_drop_helper.js
Last active December 11, 2019 13:19 — forked from druska/native_js_drag_and_drop_helper.js
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = document.createEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
@olih
olih / jq-cheetsheet.md
Last active May 3, 2024 05:32
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@midwire
midwire / ffmpeg-install.sh
Last active September 4, 2018 08:00 — forked from clayton/ffmpeg-install.sh
Install FFMPEG on OS X with HomeBrew and all libs and support
brew install ffmpeg \
--with-dcadec \
--with-faac \
--with-fdk-aac \
--with-ffplay \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-libass \
--with-libbluray \
@kkosuge
kkosuge / sample.php
Last active April 8, 2022 09:46
PHP <=> Ruby ( OpenSSL AES-256-CBC )
<?php
const PASSWORD = '!!!!!sufficiently_long_password!!!!!';
const CIPHER_METHOD = 'AES-256-CBC';
function encrypt($str) {
$iv_length = openssl_cipher_iv_length(CIPHER_METHOD);
$iv = mcrypt_create_iv($iv_length, MCRYPT_RAND);
$str = $iv.$str;
$val = openssl_encrypt($str, CIPHER_METHOD, PASSWORD, 0, $iv);
@druska
druska / native_js_drag_and_drop_helper.js
Created August 26, 2015 03:56
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)