Skip to content

Instantly share code, notes, and snippets.

View haile01's full-sized avatar
💤
Too lazy to procrastinate

Le Dinh Hai haile01

💤
Too lazy to procrastinate
View GitHub Profile
@haile01
haile01 / main.py
Created June 26, 2022 05:56
Simple python script to embed message image into carrier image using lsb :>
import cv2
import sys
import numpy as np
def hide(carrier_file, message_file, output_file = 'result.png', bit_plane = 0, channel = 0):
carrier = cv2.imread(carrier_file)
message = cv2.imread(message_file)
output = carrier.copy()
cw, ch, _ = carrier.shape
apt-get update
apt-get install openssh-server git zsh
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
zsh
echo "syntax on\nset si\nset ai\nset tabstop=2\nset shiftwidth=2\nset expandtab" >> ~/.vimrc
@haile01
haile01 / 10.txt
Last active January 30, 2022 15:21
word list for wordle
nootropics
noometries
amoebocyte
amoebiasis
amoralisms
amoralists
amorphisms
adulterant
zymometers
zymologist
#include <iostream>
#include <math.h>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;
class Helper {
private:
@haile01
haile01 / cp-tmux.sh
Created August 28, 2021 09:24
Another bash script for terminal + cp enthusiasts. It setups a tmux window with 4 panes as provided configuration
# Run cp-tmux.sh <problem-name>
# cpp.sh script is here https://gist.github.com/pythagore1123/0962c6f018b153b9697372219d455f68
# The 4 panes of tmux is config as below:
# ----------------------------------------
# | |
# | .cpp editor |
# | |
# |---------------------------------------
# | runner | .inp editor |
# | + |-------------------|
#!/bin/bash
# To create workspace, run ./judge.sh --prepare <file_name>, it will create a main code file <file_name>_ans.cpp, a judger file <file_name>.cpp and a test generator file <file_name>_gen.cpp
# To start judging, run ./judge.sh <file_name> and sit back, enjoy ;)
if [[ $1 == "--prepare" ]]; then
echo -e "#include <bits/stdc++.h>\nusing namespace std;\n\n\nint main() {\n\t// Main source code here\n}" > "./$2.cpp";
echo -e "#include <bits/stdc++.h>\nusing namespace std;\n\n\nint main() {\n\t// Bruteforce solution here\n}" > "./$2_ans.cpp";
echo -e "#include <bits/stdc++.h>\nusing namespace std;\n\n\nint main() {\n\t// Test generator here\n}" > "./$2_gen.cpp";
else
@haile01
haile01 / main.py
Created April 23, 2021 09:05
Fomat result of division of integers into decimal form
#!/usr/bin/env python3
import math
import sys
# Usage: ./main.py a b
# Prints out result of division a/b in format x.y(z)
# Example: 13/12 = 1.08(3)
a, b = [int(c) for c in sys.argv[1:]]
# turn a / b into x.y(z)
@haile01
haile01 / cpp.sh
Last active August 28, 2021 09:26
Bash script for cpp automation in CP for vim enthusiasts
#!/bin/bash
# A simple bash script to automate compiling and running CP codes for vim enthusiasts
# === HOW TO USE ===
# It is recommended to split up to 4 screens: code editor (1), gcc output (2), input editor (3), output watch (4)
# and create 3 files: <name>.cpp, <name>.inp, <name>.out
# - Run "cpp.sh <name>" in gcc output (2)
# - Run "tail -f -v <name>.out" in output watch (4)
# - Code as you like in <name>.cpp file and edit input in <name>.inp, any save action in vim would trigger the script to compile and run the code
# Disclaimer: Use standard I/O, the script've already piped input and output to the program.
const score=$("#score");
const question=$("#question");
var contestants=[];
var questions=[];
var socket = io.connect("http://"+document.domain+":"+location.port);
var idq=-1;
var ids=0;
var sfx = new Audio();
sfx.type="audio/wav";