Skip to content

Instantly share code, notes, and snippets.

.386
.model small, c
;----------------------------------------------------------------
; Stak segment
stack_seg SEGMENT stack
DB 100 DUP(?)
.model small
.data
Filename db 'file.txt',00h
FHndl dw ?
Buffer db 80h dup(?)
.stack 100h
.code
Program:
mov ax, @data
mov ds, ax
@iamdylanngo
iamdylanngo / docker compose install bash
Last active December 6, 2022 11:45
install-docker-compose-aws-user-data
#!/bin/bash
# Support ubuntu 20.04 lts
# Install docker
apt-get update
apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
@iamdylanngo
iamdylanngo / gist:656d88cc270a587a172bc746379ab6f1
Last active February 7, 2022 04:37
ubuntu-gnome-extension
sudo apt install gnome-shell-extensions
gnome-tweaks
sudo apt install chrome-gnome-shell
@iamdylanngo
iamdylanngo / hash-function
Created December 26, 2021 15:04
hash-function
Hash Functions
A comprehensive collection of hash functions, a hash visualiser and some test results [see Mckenzie et al. Selecting a Hashing Algorithm, SP&E 20(2):209-224, Feb 1990] will be available someday. If you just want to have a good hash function, and cannot wait, djb2 is one of the best string hash functions i know. it has excellent distribution and speed on many different sets of keys and table sizes. you are not likely to do better with one of the "well known" functions such as PJW, K&R[1], etc. Also see tpop pp. 126 for graphing hash functions.
djb2
this algorithm (k=33) was first reported by dan bernstein many years ago in comp.lang.c. another version of this algorithm (now favored by bernstein) uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; the magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.
unsigned long
hash(unsigned char *str)
{
unsigned long hash = 5381;
int c;
@iamdylanngo
iamdylanngo / install-php8.1-ubuntu-20.04
Created December 4, 2021 01:49
install-php8.1-ubuntu-20.04
# Add repository PHP to ubuntu 20.04
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
# Install PHP 8.1 to run Wordpress, Magento 2
sudo apt install php8.1-common php8.1-cli php8.1-fpm php8.1-opcache php8.1-gd php8.1-mysql php8.1-curl php8.1-intl php8.1-xsl php8.1-mbstring php8.1-zip php8.1-bcmath php8.1-soap
@iamdylanngo
iamdylanngo / docker-compose-erlang
Created September 11, 2021 12:38
docker-compose-erlang
version: '3.7'
services:
erlang:
image: dylanops/erlang:22
container_name: erlang
volumes:
-./project/path:/home/erlang/app
- ~/.cache/rebar3:/home/erlang/.cache/rebar3
ports:
@iamdylanngo
iamdylanngo / compiler-php-7.3-on-ec2
Last active September 9, 2021 05:34
Compiler php with LiteSpeed on amazone linux 2
sudo yum install gcc
sudo yum install libxslt-devel
sudo yum install openssl-devel
sudo yum install sqlite-devel
sudo yum install curl-devel
sudo yum install oniguruma-devel
sudo yum install gd gd-devel php-gd
sudo yum install pcre-devel zlib zlib-devel libzip-devel make
@iamdylanngo
iamdylanngo / install-terraform-ubuntu-20
Last active May 15, 2021 03:34
install-terraform-ubuntu-20
# Install terraform on ubuntu
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt install terraform
# install with specify version
sudo apt install terraform=0.14.0
terraform version
@iamdylanngo
iamdylanngo / MAMP-PRO-Magento2-Nginx
Created April 18, 2021 23:50
MAMP-PRO-Magento2-Nginx
# Please change path to your project
set $MAGE_ROOT /Applications/MAMP/htdocs/m235cc/pub/;
index index.php;
autoindex off;
charset UTF-8;
error_page 404 403 = /errors/404.php;
#add_header "X-UA-Compatible" "IE=Edge";