Skip to content

Instantly share code, notes, and snippets.

@Aqua-4
Aqua-4 / linux_setup.sh
Last active March 4, 2024 17:55
Quickly setup my linux environment
sudo apt update && sudo apt upgrade -y
sudo apt-get install openssh-server
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
@Aqua-4
Aqua-4 / keras_train.py
Created July 22, 2023 06:49
Keras training with auto stop
"""
Here's a high-level overview of the recommended architecture for text correction using a Seq2Seq model:
1. Encoder:
- Input: Incorrect text sequence
- Apply word embeddings to convert each word into a fixed-length vector representation
- Pass the embedded input sequence through one or more recurrent layers, such as LSTM or GRU, to capture the contextual information of the input sequence
- The final hidden state(s) of the encoder will serve as the initial state of the decoder
2. Decoder:
@Aqua-4
Aqua-4 / vnc-watcher.sh
Created July 11, 2021 10:42
Script to reboot Raspberry pi when vnc server stops working
TIMED_OUT="HostedRendezvous: Rendezvous lookup failed: Hosted Bootstrap error: Network failure: Timed out fetching resource"
# sample response variable
# RESP="Jun 23 17:49:07 pi-desktop vncserver-x11[915]: HostedRendezvous: Rendezvous lookup failed: Hosted Bootstrap error: Network failure: Timed out fetching resource"
RESP=$(service vncserver-x11-serviced status)
if [[ "$RESP" =~ "$TIMED_OUT" ]]; then
echo "Network Failure, commencing reboot"
$(reboot)
@Aqua-4
Aqua-4 / ffmpeg_conversion.sh
Created December 26, 2020 07:35
Covert to html5 compatible video using ffmpeg
#!/bin/bash
for filename in assets/completed/*.mp4; do
_filename=${filename::-4}
ffmpeg -i $_filename.mp4 $_filename.avi
rm $_filename.mp4
ffmpeg -i $_filename.avi $_filename.mp4
rm $_filename.avi
done
@Aqua-4
Aqua-4 / chained_promise.js
Created July 14, 2020 12:05
Chaining Promises
let tmp = ["#chart_placeholder_0", "#prod_fill_weight_placeholder"]
Promise.all(tmp.map(d => html2canvas(document.querySelector(d))))
.then(function (images) {
_.each(images, (canvas, idx) => {
img.file(`${idx}.png`, canvas.toDataURL("image/png", [0.0, 1.0]).split(',')[1], { base64: true });
})
// after
zip.generateAsync({ type: "blob" }).then(function (content) {
@Aqua-4
Aqua-4 / get_info.py
Created March 9, 2020 09:04
gmaps-api v3 - get country name and area_lv_1 name
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 12:47:29 2020
@author: parashar
"""
import googlemaps