- MacOS Sequoia 15.1.1
- python 3.11.9 installed via pyenv
- python
venvvirtual environment - poetry package manager
poetry add librosa
| # list sort by time descending, return 5 | |
| ls -t | head -n 5 | |
| # list directory with size | |
| du -hd -n 1 . | |
| # Terminal history | |
| history | |
| # Check PID that being used by a port |
| import { createWriteStream } from 'fs' | |
| (() => { | |
| try { | |
| const res = createWriteStream('/path/to/not/exists/dir/file.txt') | |
| res.on('error', (err) => { | |
| console.error('here is how you handle error') | |
| }) |
| // visit website https://kawalpemilu.org | |
| // open javascript console | |
| // copy script below | |
| const interval = 5_000 // 5s 5000ms | |
| const refreshButton = document.querySelector('body > app-root > div > mat-sidenav-container > mat-sidenav-content > app-hierarchy > div > header > div > button') | |
| setInterval(() => { | |
| refreshButton.click() | |
| }, interval) |
| import pyvirtualcam | |
| import cv2 | |
| fmt = pyvirtualcam.PixelFormat.BGR | |
| cap = cv2.VideoCapture(0) | |
| with pyvirtualcam.Camera(width=1280, height=720, fps=20, fmt=fmt) as cam: | |
| while True: | |
| ret_val, frame = cap.read() |
| <!-- Form to delete Story --> | |
| <form class="d-inline justify-content-end" action="/blog/<?=$ablog['blog_id']?>/delete" method="post"> | |
| <?= csrf_field(); ?> | |
| <button class="btn btn-outline-danger btn-sm">Delete</button> | |
| </form> |
| <!-- Edit Button --> | |
| <small class=" btn btn-outline-warning btn-sm float-right"> | |
| <a type="button" data-toggle="modal" data-target="#editModal<?= $ablog['blog_id']?>">edit</a> | |
| </small> | |
| <!-- Edit Story Modal --> | |
| <div class="modal fade" id="editModal<?= $ablog['blog_id']?>" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true"> | |
| <div class="modal-dialog" role="document"> | |
| <div class="modal-content"> | |
| <form method="post" action="/blog/<?= $ablog['blog_id']?>/update" > |
| <?php | |
| $blog_chunked = array_chunk($blog, 3); | |
| foreach($blog_chunked as $row) | |
| { | |
| ?> | |
| <div class="row"> | |
| <div class="container menu-section"> | |
| <div class="row py-5 align-items-center "> | |
| <?php | |
| foreach($row as $ablog) |
| <?= $this->extend('layout') ?> | |
| <?= $this->section('css') ?> | |
| <link rel="stylesheet" href="css/blog_style.css"> | |
| <?= $this->endSection() ?> | |
| <?= $this->section('js') ?> | |
| <?= $this->endSection() ?> | |
| <?= $this->section('title') ?> |
| <!-- Add Story button --> | |
| <div data-toggle="tooltip" data-placement="top" title="Add New Story"> | |
| <p type="button" data-toggle="modal" data-target="#addModal" class="float"> | |
| <i class="fa fa-plus my-float"></i> | |
| </p> | |
| </div> | |
| <!-- Add Story Modal --> | |
| <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true"> | |
| <div class="modal-dialog" role="document"> |