Skip to content

Instantly share code, notes, and snippets.

View sawaYch's full-sized avatar
🐧
Focusing

Sawa sawaYch

🐧
Focusing
View GitHub Profile
@sawaYch
sawaYch / yt-dlp.md
Last active April 20, 2024 07:52
yt-dlp readme

yt-dlp usage

# check format & codec
yt-dlp -F https://www.youtube.com/watch?v=vWsmn3-7scs
# output
[info] Available formats for vWsmn3-7scs:
ID  EXT RESOLUTION FPS │   FILESIZE   TBR PROTO │ VCODEC        VBR ACODEC      ABR ASR MORE INFO
────────────────────────────────────────────────────────────────────────────────────────────────────────────
139 m4a audio only     │ ~ 66.18MiB   64k dash  │ audio only        mp4a.40.5   64k 22k DASH audio, m4a_dash
140 m4a audio only     │ ~148.90MiB  144k dash  │ audio only        mp4a.40.2  144k 44k DASH audio, m4a_dash
@sawaYch
sawaYch / Determination.txt
Last active January 15, 2024 10:46
+ You are filled with Determination +
┏━━━━━━━━━━━━━━┓
┃ ┃
┃ ❤️ |
| |
┗━━━━━━━━━━━━━━┛
@sawaYch
sawaYch / chall.py
Created December 6, 2023 15:12
hkcert23 ctf sign me a flag
import signal
import os
import hmac
import hashlib
import sys
def tle_handler(*args):
print('⏰')
sys.exit(0)
@sawaYch
sawaYch / b141.py
Created December 5, 2023 12:09
B141:【異世界コラボ問題】ガーベラ・コレクション
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
def min_adjacent_swap(arr):
swap_times = 0
n = len(arr) / 2
iter = 0
while iter < len(arr) - 1:
# if current not ideal
if arr[iter] != iter % n:
@sawaYch
sawaYch / IBM_Thinkpad_x60.md
Last active November 19, 2023 10:52
A upgrade log of IBM Thinkpad X60.

IBM Think-Pad X60 Upgrade Log

These day, I tried to upgrade second-hand X60 IBM Think-pad.

It is a really old model (Intel Core 2 Duo ), but still good to use.

It has facing several problems and I am trying to use minimum cost (maybe) to increase the user experience :P

@sawaYch
sawaYch / code-snippet.js
Created August 15, 2019 18:06
Firebase storage listAll() example.
// Load single image
// replace images/photo6244288433388366130.jpg with your image path
// You can find it on the firebase storage console
var imgRef = firebase.storage().ref().child('images/photo6244288433388366130.jpg');
imgRef.getDownloadURL().then(function(url){
var img = document.getElementById('img1');
img.src = url;
}).catch(function(error) {
@sawaYch
sawaYch / convert.js
Last active September 6, 2023 00:37
batch convert webp to webm, maybe useful for converting Whatsapp sticker to Telegram.
/**
require webp & libwebp, see https://developers.google.com/speed/webp/download
run:
cd working_dir # suppose working dir contains all webp that u want to convert
node ./convert.js # wait for it until done
*/
const child = require("child_process");
const fs = require("fs");
const path = require("path");
const util = require("util");
@sawaYch
sawaYch / LUKS-notes.md
Last active August 24, 2023 06:31
Introduction to LUKS.

What is Cryptsetup and LUKS

Cryptsetup is a utility used to conveniently set up disk encryption based
on the DMCrypt kernel module.
These include plain dm-crypt volumes, LUKS volumes, loop-AES
and TrueCrypt (including VeraCrypt extension) formats.
The project also includes a veritysetup utility used to conveniently setup
DMVerity block integrity checking kernel module
and, since version 2.0, integritysetup to setup
DMIntegrity block integrity kernel module.

@sawaYch
sawaYch / example.ts
Created June 2, 2023 13:18
override yup date() default typeError validation message
// https://github.com/jquense/yup/issues/394
import i18next from "i18next";
import { setLocale } from "yup";
export const setFormikLocale = (i18n: typeof i18next): void => {
// Config yup validation schema default error message
setLocale({
mixed: {
notType: (_ref) => {
@sawaYch
sawaYch / .travis.yml
Last active May 10, 2023 16:46
Conditional Build in Travis-CI
matrix:
include:
# config for PHP, server side codebase
- language: php
php:
- 7.0
# deploy jobs here
install:
- cd backend_server && composer install
# unit test jobs here