Skip to content

Instantly share code, notes, and snippets.

@hbakhtiyor
hbakhtiyor / enc.go
Last active June 13, 2020 05:58
AES GCM Encryption/Decryption with Chunking Example in Golang, using OpenSSL
package main
import (
"bufio"
"bytes"
"encoding/hex"
"fmt"
"io"
"os"
@hbakhtiyor
hbakhtiyor / data.json
Last active July 22, 2024 00:03
Stars, Forks, Issues, Last Commits, ... for Popular E-Commerce Platforms
{"shopware/shopware":{"19884":{"size":266401,"stargazers_count":2672,"watchers_count":2672,"forks_count":977,"open_issues_count":693,"forks":977,"open_issues":693,"watchers":2672,"network_count":977,"subscribers_count":108,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-06-10T10:55:13Z","pushed_at":"2024-06-10T10:55:09Z"},"19885":{"size":265638,"stargazers_count":2675,"watchers_count":2675,"forks_count":977,"open_issues_count":692,"forks":977,"open_issues":692,"watchers":2675,"network_count":977,"subscribers_count":108,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-06-10T16:09:42Z","pushed_at":"2024-06-10T17:09:47Z"},"19886":{"size":265896,"stargazers_count":2677,"watchers_count":2677,"forks_count":977,"open_issues_count":695,"forks":977,"open_issues":695,"watchers":2677,"network_count":977,"subscribers_count":107,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-06-11T23:14:53Z","pushed_at":"2024-06-12T05:04:56Z"},"19887":{"size":266091,"stargazers_count":2675,"watchers_count":2675,"forks
setInterval(function() {
t = $(".following").find(".follow-button"); //.not-following
if (!t[0]) {
window.scrollTo(0,
$(document).height());
} else {
console.log(t.attr("class"));
t.trigger("click");
}
}, 100
{
"query": {
"function_score": {
"query": {
"bool": {
"must": [],
"must_not": [],
"should": [],
"filter": [{ "term": { "is_deleted": false } }],
"minimum_should_match": 1
@hbakhtiyor
hbakhtiyor / dummy.js
Created June 30, 2015 10:39
Restricting some methods for resolving challenges without using the methods
// Method names for exclusion
excludes = []
// e.g. excluding pop & push methods
// excludes = ['pop', 'push'];
// Objects for mocking
objects = [Array];
// The restriction only effect inside the
// function (nested functions, chained invoking functions, ...)
@hbakhtiyor
hbakhtiyor / openssl_hack.sh
Last active May 9, 2019 18:53
Send secure email messages/files using SSL public certificate without PGP keys
# https://www.madboa.com/geek/openssl - Some usefull openssl cooks.
# If you couldn't find somebody's PGP key, you can still send secure
# email using their SSL public certificate
# Fetching public certificate from example.com server and grabing the key from stream.
openssl s_client -connect example.com:443 | sed -ne \
'/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > publickey.pem
# Encrypting a file/message using retrieved public certificate.
# You can choose another encryption algorithms, rather than `des3`.
# If a file is a binary file, you must put `-binary` option.
@hbakhtiyor
hbakhtiyor / list_of_patches.txt
Created May 21, 2015 05:08
List of some urls for patches
https://github.com/rails/rails/pulls?q=is%3Apr+author%3Ahbakhtiyor+is%3Aclosed
https://github.com/mattdbridges/validates_formatting_of/pulls?q=is%3Apr+author%3Ahbakhtiyor+is%3Aclosed
https://github.com/mattdbridges/validates_formatting_of/pulls/hbakhtiyor
https://github.com/rubyzip/rubyzip/pulls?q=is%3Apr+author%3Ahbakhtiyor+is%3Aclosed
https://github.com/thoughtbot/shoulda-matchers/pulls?q=is%3Apr+author%3Ahbakhtiyor+is%3Aclosed
https://github.com/mongoid/mongoid/pulls?q=is%3Apr+author%3Ahbakhtiyor+is%3Aclosed
and another patches at ruby communities.
def count_bottom_leaves(binary_tree)
return helper(binary_tree, get_depth_leaf(binary_tree))
end
def helper (binary_tree, bound_depth, depth=0)
return 0 if(binary_tree == false)
left_node = binary_tree[1]
right_node = binary_tree[2]
var count_bottom_leaves = function(binary_tree) {
return helper(binary_tree, get_depth_leaf(binary_tree, 0), 0)
}
var helper = function(binary_tree, bound_depth, depth) {
if(binary_tree == false) { return 0 }
var left_node = get(binary_tree, 1)