Skip to content

Instantly share code, notes, and snippets.

@willnode
willnode / 0-strapi-auto-permissions.md
Last active September 13, 2021 08:04
Strapi automatic permission sets

Strapi permissions and user roles are set using database, which will make your permission sets inconsistent.

Here make it automatic. Put these files in config/functions/

@willnode
willnode / update-pip3.8.sh
Created August 6, 2021 04:23
Update and Fix Python PIP on Linux Centos
pip --version
pip install -U pip
dnf reinstall python3.8 -y
alternatives --install /usr/bin/pip pip /usr/local/bin/pip3.8 1
alternatives --set pip /usr/local/bin/pip3.8
pip --version
@willnode
willnode / tex_glue_box
Last active August 2, 2021 01:31
TeX vs TEXDraw Glue Box Grid
Ord Op Bin Rel Open Close Punct Inner
Ord 0 1 2 3 0 0 0 1
Op 1 1 * 3 0 0 0 1
Bin 2 2 * * 2 * * 2
Rel 3 3 * 0 3 0 0 3
Open 0 0 * 0 0 0 0 0
Close 0 1 2 3 0 0 0 1
Punct 1 1 * 1 1 1 1 1
Inner 1 1 2 3 1 0 1 1
@willnode
willnode / snapshotall.ps1
Created April 16, 2021 03:33
Remove All Previous Snapshot then generate new ones in Digital Ocean
$sw = [Diagnostics.Stopwatch]::StartNew()
# Drop all existing snapshot
$snapshots = doctl compute snapshot list --format ID --no-header
foreach ($line in $snapshots) {
doctl compute snapshot delete $line -f
}
# List all droplets and create snapshot
$droplets = doctl compute droplet list --format ID,Name --no-header
foreach($line in $droplets) {
@willnode
willnode / mysqlb.sh
Created December 1, 2020 07:56
Bash script to backup MySQL data efficiently
#!/bin/bash
timestamp=`date +%Y%m%d-%H`
tar -cf /root/mysqlb/backup-`echo $timestamp`.tar /var/lib/mysql
gzip -1 /root/mysqlb/backup-`echo $timestamp`.tar
find /root/mysqlb/ -type f -mtime +7 -name '*.gz' -print0 | xargs -r0 rm --
{
"url": "url_here",
"database": {
"client": "mysql",
"connection": {
"host" : "localhost",
"user" : "username_here",
"password" : "password_here",
"database" : "database_here",
"charset" : "utf8mb4"
@willnode
willnode / .htaccess
Created April 9, 2020 01:27
CodeIgniter4 .htaccess config if you insist to host it at project root rather than /public directory. Used by https://github.com/willnode/crm-toolkit
# Generally you wouldn't point your server at api root.
# Althought it works, always configure your server
# correctly when you're doing production!
# That's enough warning. If you put this directory
# on subdirectory, please configure that to here.
# Don't forget to set $uriProtocol to PATH_INFO (Config/App.php)
<IfModule mod_rewrite.c>
@willnode
willnode / java_download.sh
Created September 21, 2019 09:39 — forked from wavezhang/java_download.sh
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.tar.gz
// Place your settings in this file to overwrite the default settings
{
"files.exclude": {
"**/*.meta": true,
"**/Dump": true,
"**/bin": true,
"**/obj": true,
"**/~$*": true,
"**/.vs": true,
"**/_site/": true,
@willnode
willnode / hology_comb.md
Last active November 14, 2018 03:56
Hology CP 2018

Soal 2

Description

Di sebuah perusahaan bernama Coconut.Inc, seorang pekerja dimintai bossnya untuk menciptakan sebuah aplikasi generator key yang dapat merahasiakan pesan yang akan disampaikan. Bantu dia untuk menyelesaikan pekerjaannya!

Input Format

Baris pertama merupakan input user yang berisikan dictonary (key dan value) dari secret key yang akan digenerate.

Baris kedua merupakan inputan user yang berisikan kalimat yang akan dijadikan pesan rahasia.