Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Nya?

Himura Kazuto Himura2la

💭
Nya?
View GitHub Profile
@Himura2la
Himura2la / GetPoshGit.ps1
Last active Oct 15, 2021
Install posh-git
View GetPoshGit.ps1
PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
@"
function g {
param (
[Parameter(ValueFromRemainingArguments)] [string[]] $p = 'status'
)
Write-Host "& git $p"
& git $p
Import-Module posh-git
}
@Himura2la
Himura2la / GitHubMassCollect.ps1
Created Oct 7, 2021
Get paginated data from GitHub API
View GitHubMassCollect.ps1
# Token: https://github.com/settings/tokens | Scope: user
$Headers = @{
"Authorization" = "token <...>"
"Accept" = "application/vnd.github.v3+json";
}
$Api = 'https://api.github.com'
function MassCollect {
param (
[Parameter(Mandatory)] [string] $ApiMethod
@Himura2la
Himura2la / untag_mp3.sh
Last active Sep 10, 2021
Remove ID3 tags from mp3 files
View untag_mp3.sh
mkdir t
mv *.mp3 t
pushd t
find . -type f -name '*.mp3' -exec ffmpeg -i '{}' -vn -codec:a copy -map_metadata -1 '../{}' \;
popd
rm -r t
@Himura2la
Himura2la / wsl-podman.sh
Last active Oct 12, 2021
Install podman on WSL Debian (2021)
View wsl-podman.sh
sudo apt -y install podman
sed -e 's/# cgroup_manager = "systemd"/cgroup_manager = "cgroupfs"/' \
-e 's/# events_logger = "journald"/events_logger = "file"/' \
/usr/share/containers/containers.conf | sudo tee /etc/containers/containers.conf
@Himura2la
Himura2la / wsl-fix-search-domain.md
Created Sep 1, 2021
How to fix domain hosts resolve in WSL
View wsl-fix-search-domain.md

In your Debian or Ubuntu WSL do:

cat << EOF | sudo tee /etc/wsl.conf
[network]
generateResolvConf = false
EOF
@Himura2la
Himura2la / writePngWithText.js
Last active Aug 26, 2021
Embed text into a PNG file (by draw.io project)
View writePngWithText.js
// Source: https://github.com/jgraph/drawio/blob/v14.9.9/src/main/webapp/electron.js#L970
//NOTE: Key length must not be longer than 79 bytes (not checked)
function writePngWithText(origBuff, key, text, compressed, base64encoded)
{
var isDpi = key == 'dpi';
var inOffset = 0;
var outOffset = 0;
var data = text;
var dataLen = isDpi? 9 : key.length + data.length + 1; //we add 1 zeros with non-compressed data, for pHYs it's 2 of 4-byte-int + 1 byte
@Himura2la
Himura2la / dropbear_default_key.sh
Last active Aug 17, 2021
How to use Git with the Dropbear SSH client (on Omega2)
View dropbear_default_key.sh
dropbearkey -t rsa -f ~/.ssh/id_dropbear
dropbearkey -y -f ~/.ssh/id_dropbear
@Himura2la
Himura2la / DetectIE.js
Last active Jul 13, 2021
Detect Internet Explorer with the code that Internet Explorer does not understand xD
View DetectIE.js
['MSIE', 'Trident'].reduce((p, c) => p || (navigator.userAgent.indexOf(c) >= 0), false)
View tampermonkey_helpers.js
// ==UserScript==
// ...
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function () {
...
function httpRequestAsync(url,
View printing-checklist.md
  • Подготовка макета:
    • Поля: с 3 сторон по 5мм, с крепления 20мм
      • 5мм от края фона до значимого контента
      • 3мм от линии реза до значимого контента
      • 2мм между линией реза и краем фона margins
    • PDF vs. TIFF
    • Выставить корректный ICC-профиль RGB