Skip to content

Instantly share code, notes, and snippets.

View ElvinEfendi's full-sized avatar

Elvin Efendi ElvinEfendi

View GitHub Profile
diff --git a/images/nginx/rootfs/Dockerfile b/images/nginx/rootfs/Dockerfile
index e639687f1..4893f3c54 100644
--- a/images/nginx/rootfs/Dockerfile
+++ b/images/nginx/rootfs/Dockerfile
@@ -13,7 +13,7 @@
# limitations under the License.
-FROM alpine:3.13 as builder
+FROM alpine:3.14.2 as builder
@ElvinEfendi
ElvinEfendi / fisher-yates-luajit.lua
Created April 11, 2020 01:57
Original + 2 extra implementations of Fisher-Yates shuffling algorithm tested against original implementation
local newtab = require "table.new"
math.randomseed(1000)
-- this function generates result by both swapping elements
-- of an array in place as well as without using an array at all
--
local function select_k_random(k, n)
local arr = newtab(n, 0)
for i = 1, n do
@ElvinEfendi
ElvinEfendi / malloc.c
Last active June 22, 2019 21:40
example C program to read and parse certificate
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <stdint.h>
#include <sys/mman.h>
#include <openssl/ssl.h>
#include <malloc.h>
#include <unistd.h>
@ElvinEfendi
ElvinEfendi / hash_with_bf.rb
Last active November 11, 2015 21:42
Hash checksum based on the keys using bloom filter
require 'bloomfilter-rb'
class HashWithBf < Hash
def []=(key, value)
super(key, value)
bf.insert(key)
end
def delete(key)
super(key)
@ElvinEfendi
ElvinEfendi / number_in_words.py
Last active June 22, 2019 21:44
Ədədin sözlərlə göstərilməsi, Python-da
# *-* coding: utf-8 *-*
# miylondan sonra ucun sadece bura elave etmek kifayet edir
# misal: milyard ucun sadece words[1000000000] = 'milyard' kifayet edir
words = { 1: ['bir', 'iki', 'üç', 'dört', 'beş', 'altı', 'yeddi', 'səkkiz', 'doqquz'],
10: ['on', 'iyirmi', 'otuz', 'qırx', 'əlli', 'altmış', 'yetmiş', 'səksən', 'doxsan'],
100: 'yüz',
1000: 'min',
1000000: 'milyon'}