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 May 6, 2024 05:06
Stars, Forks, Issues, Last Commits, ... for Popular E-Commerce Platforms
{"shopware/shopware":{"19829":{"size":260684,"stargazers_count":2598,"watchers_count":2598,"forks_count":955,"open_issues_count":672,"forks":955,"open_issues":672,"watchers":2598,"network_count":955,"subscribers_count":110,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-04-14T20:45:43Z","pushed_at":"2024-04-16T10:16:36Z"},"19830":{"size":260858,"stargazers_count":2597,"watchers_count":2597,"forks_count":956,"open_issues_count":671,"forks":956,"open_issues":671,"watchers":2597,"network_count":956,"subscribers_count":110,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-04-16T15:46:16Z","pushed_at":"2024-04-16T14:21:30Z"},"19831":{"size":260804,"stargazers_count":2599,"watchers_count":2599,"forks_count":956,"open_issues_count":672,"forks":956,"open_issues":672,"watchers":2599,"network_count":956,"subscribers_count":110,"created_at":"2018-05-03T13:00:31Z","updated_at":"2024-04-18T03:28:57Z","pushed_at":"2024-04-17T19:31:34Z"},"19832":{"size":261350,"stargazers_count":2604,"watchers_count":2604,"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)