Skip to content

Instantly share code, notes, and snippets.

View htnminh's full-sized avatar

Hoàng Trần Nhật Minh htnminh

View GitHub Profile
@htnminh
htnminh / gist:ea8976a5a3a59cb6961eedd1002bfc67
Last active August 19, 2021 11:40
Greedy & Backtracking Implementation (Pseudocode)
initialize as none but with sufficient length: model
initialize as none: best_model
function try(position):
if position is not in model:
if model is better than best_model, or best_model is none:
assign best_model as model
else:
do nothin
else:
@htnminh
htnminh / buddhism.py
Last active July 15, 2022 17:05
Buddhism: Immediately reduce the number of bugs to 0.
# _oo0oo_
# o8888888o
# 88" . "88
# (| -_- |)
# 0\ = /0
# ___/`---'\___
# .' \| |// '.
# / \||| : |||// \
# / _||||| -:- |||||- \
# | | \\ - /// | |
@htnminh
htnminh / 211108_1.py
Created November 8, 2021 01:43
Generate binary strings
class BinStr():
def __init__(self, n):
self.n = n
self.curr = [0 for i in range(n)]
def __str__(self):
return ''.join([str(x) for x in self.curr])
def final(self):
return self.curr == [1 for i in range(self.n)]
@htnminh
htnminh / 211108_2.py
Created November 8, 2021 02:59
Generate subsets
class Subset():
def __init__(self, n, m):
self.n = n
self.m = m
self.a = [None] + [i for i in range(1, m+1)]
def __str__(self):
return ''.join([str(x) for x in self.a[1:]])
def final(self):
@htnminh
htnminh / 211108_3.py
Created November 8, 2021 02:59
Generate permutations
class Permutation():
def __init__(self, n):
self.n = n
self.a = [None] + [i for i in range(1, self.n+1)]
def __str__(self):
return ''.join([str(x) for x in self.a[1:]])
def final(self):
return self.a == [None] + [i for i in range(self.n, 0, -1)]
from ortools.sat.python import cp_model
import numpy as np
import random as rd
class VarArraySolutionPrinter(cp_model.CpSolverSolutionCallback):
#print intermediate solution
def __init__(self,variables):
cp_model.CpSolverSolutionCallback.__init__(self)
self.__variables = variables
@htnminh
htnminh / 20204883 multicast routing.py
Created December 15, 2021 14:41
20204883 multicast routing.py
from ortools.sat.python import cp_model
from copy import deepcopy
class VarArraySolutionPrinter(cp_model.CpSolverSolutionCallback):
"""Print intermediate solutions."""
def __init__(self, variables):
cp_model.CpSolverSolutionCallback.__init__(self)
self.__variables = variables
@htnminh
htnminh / jobs.md
Last active December 21, 2021 10:04
jobs for ai intro proj

thu 3

  • phuc: add time-limit, choose 2 algos (t3)
  • phuc, nam: clean up code (t3)

thu 4

  • minh: analyze algo (t4)

thu 5

  • tan: write report phan tich..., gioi thieu thuat toan, ket luan gi gi day... (t5)
  • phong, nam | phuc, tan: viet ve thuat toan da lam (thuc hien thuat toan) (t5)
@htnminh
htnminh / aes_ecb_128-bits.txt
Created May 3, 2022 14:50
MY DARKEST SECRET
173d81efb66529e8b6bef9bd4baec8affb6bf395d60d732bb2b9dee1c3d3bb61843ecf3fe1c673f568700a9da726cb9e2d196cfb6fa304abf21844f0bcdd6f0075262a8bdee33b4a74b717a5525a551d3d8c1c91ec5a26f1d7910f61a2009bc8dc12c450b4d5dcbff08eae9f7f337823de56411b9ae3018ccfe3b92f370a4df84cf710dbf3f587208c22cf8b9523d70ef7a8036bc827287a53248eb66287fbdb97253963220c873bfcb58621fc4080bdfebfb5e282cf77ab41b530d307653253e1c3987b933d6651bc325bbaa47bbff0218ee0a3c8fdda8b8f5bcb90dbbe8a89724c7cfe8e275ccbff7df22553b4fa67c59a888f3dbbab1b802d2b6369e498dd2ab61d19fd5261aefcd61d87231298201173f3459fcd2fbdc3be092a409136f77b5884455661930c38a5a86f23615f82480ba9c163f5aa7d3ee60f9f405c2c8a399293fb8b1f9a65e61023e62a5422510f742ef5ccbda7c103d3be5cdb60125e639b1f43d0c0496a9812ccfead41ea85c66fa5c8bf94ad0ab532babdd3c9fcda49fc1f70002261ebc634eb2a75f7b9c7c586b2d78cd18ca8c48ef2fa95d40e67ec0be95992f1c0a3fcc228acf609b89d253ba440508477851af4dbf351a0c6f6eceb259bd63980f4bfb36cd56146c9eb18018cef563a3677b2b2e3c6fa23e174d671bbbe515709a0ff1016582ca643913eb1716e7b8c28a6177757c1cccb671d
/* FIXED SYNTAX ERRORS */
use hrdb;
go
create function fullname(@fn varchar(20), @ln varchar(25))
returns varchar(50) as
begin
return @fn + ' ' + @ln;
end;
go