Skip to content

Instantly share code, notes, and snippets.

@caot
caot / sha256-hmac.md
Created July 29, 2020 03:47 — forked from jasny/sha256-hmac.md
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@caot
caot / gdb cheat_sheet.txt
Last active August 17, 2020 13:51
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
@caot
caot / centos-install-kernel-debuginfo.sh
Created May 8, 2020 03:07 — forked from jarek-przygodzki/centos-install-kernel-debuginfo.sh
CentOS 7 - How to install kernel-debuginfo
yum --enablerepo=base-debuginfo install -y kernel-debuginfo-$(uname -r)
@caot
caot / self-signed-certificate-with-custom-ca.md
Created February 14, 2020 20:05 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@caot
caot / sort-object-properties-by-value.md
Created October 24, 2019 10:13 — forked from umidjons/sort-object-properties-by-value.md
JavaScript: sort object properties by value (numeric or string)

Sort object properties by value (values are text)

I have following object:

var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};

I want sort it by city names, so after sort it should be:

var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};

But I can't sort object properties, instead can convert object into array, then sort items.

First add the below html code where you want to show in the category.html, product.html and cart.html
<div class="shipping-bar-wrapper" data-coupon-code="{{lang 'freeDelivery'}}"></div>
Add the freeDevlivery(the coupon amount) text to the en.json file in the lang file.
Add this Js code to global.js in the assets/js/theme folder
fetch('/api/storefront/cart', {
credentials: 'same-origin'
})
.then(function(response) {
@caot
caot / nginx.conf
Last active September 18, 2019 15:16 — forked from morhekil/nginx.conf
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
!function(){
var bP={};
var b=30, bb=150, height=600, buffMargin=1, minHeight=14;
var c1=[-130, 40], c2=[-50, 100], c3=[-10, 140]; //Column positions of labels.
var colors =["#3366CC", "#DC3912", "#FF9900","#109618", "#990099", "#0099C6"];
bP.partData = function(data,p){
var sData={};
sData.keys=[
@caot
caot / nginx.conf
Created December 18, 2018 19:43 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@caot
caot / django_model_graph.sh
Created November 12, 2018 20:22 — forked from perrygeo/django_model_graph.sh
Generate UML diagram of django app models
apt-get install python-pygraphviz
pip install django-extensions
# add 'django_extensions' to INSTALLED_APPS in settings.py
python manage.py graph_models trees -o test.png