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 November 23, 2024 00:02
Stars, Forks, Issues, Last Commits, ... for Popular E-Commerce Platforms
{"shopware/shopware":{"20049":{"size":281596,"stargazers_count":2823,"watchers_count":2823,"forks_count":1027,"open_issues_count":845,"forks":1027,"open_issues":845,"watchers":2823,"network_count":1027,"subscribers_count":104,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-11-22T01:29:09Z","pushed_at":"2024-11-21T17:36:06Z"},"20050":{"size":281707,"stargazers_count":2824,"watchers_count":2824,"forks_count":1027,"open_issues_count":847,"forks":1027,"open_issues":847,"watchers":2824,"network_count":1027,"subscribers_count":104,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-11-22T17:40:41Z","pushed_at":"2024-11-22T17:40:37Z"}},"shuup/shuup":{"20049":{"size":30596,"stargazers_count":2256,"watchers_count":2256,"forks_count":1101,"open_issues_count":178,"forks":1101,"open_issues":178,"watchers":2256,"network_count":1101,"subscribers_count":118,"created_at":"2015-06-03T12:53:21Z","updated_at":"2024-11-21T00:53:32Z","pushed_at":"2024-03-13T23:45:42Z"},"20050":{"size":30596,"stargazers_count":2256,"watc
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)