Skip to content

Instantly share code, notes, and snippets.

View Himura2la's full-sized avatar
💭
Nya?

Himura Kazuto Himura2la

💭
Nya?
View GitHub Profile
@Himura2la
Himura2la / makeURL.jq.js
Last active December 4, 2019 10:02
Assemble a URL using jQuery
let makeURL = (origin, location, parameters) => [origin, ...location].join('/') + '?' + $.param(parameters)
makeURL(window.location.origin, [ 'search' ], { 'query': 'hello world' })
@Himura2la
Himura2la / git-submodule-remove.sh
Last active December 24, 2019 13:10
git submodule remove
git config --global alias.submodule-remove '!git submodule deinit -f "${1%/}" && git rm --cached -f "${1%/}" && rm -rf ".git/modules/$1"'
@Himura2la
Himura2la / NestedBlockLayout.cs
Last active February 14, 2020 10:04
Embeds a flat list into a 2-level block structure. Useful for responsive UIs when you need to switch between three layout variants.
void TwoLevelsFullyDefined() {
const int itemsCount = 12;
const int level1BlocksInList = 2;
const int itemsInLevel1Block = 6;
const int level2BlocksInLevel1Block = 2;
const int itemsInLevel2Block = 3;
Console.WriteLine("<list>");
@Himura2la
Himura2la / page-manipulation.user.js
Created April 1, 2020 06:43
User script used to update page contents
// ==UserScript==
// @name Page Manipulation
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Updates page contents
// @author glagol15@gmail.com
// @include https://target.site/*
// @grant none
// ==/UserScript==
@Himura2la
Himura2la / WhoIsOnline.ps1
Created August 26, 2019 08:46
Get logged in users
qwinsta /server:ServerName
@Himura2la
Himura2la / u2f-udev-rule.sh
Last active June 9, 2020 15:29
Support U2F and FIDO2 keys in RHEL/CentOS 8
sudo wget -O /etc/udev/rules.d/70-u2f.rules https://raw.githubusercontent.com/Yubico/libfido2/master/udev/70-u2f.rules
# reboot
@Himura2la
Himura2la / install-node.sh
Last active June 15, 2020 11:52
Simplified NodeJS install script for Debian-based OS
NODEREPO="node_12.x"
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
echo "deb https://deb.nodesource.com/${NODEREPO} $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/${NODEREPO} $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install -y nodejs
@Himura2la
Himura2la / intel-video-acceleration.sh
Created June 20, 2020 17:05
Fix lags in HTML5 video on Intel Graphics Controller with i915 driver
sudo dnf install libva-intel-driver
@Himura2la
Himura2la / dos2unix.sh
Created July 8, 2020 07:27
dos2unix with find and sed
find . -type f -regex '.*\.\(yml\|json\)$' -exec sed -i $'s/\r$//' '{}' \; -exec echo "Line endings changed to LF in {}" \;
@Himura2la
Himura2la / Copy-Filtered.ps1
Created August 3, 2020 09:44
Copy-Item -Recurse with multiple filter
function Copy-Filtered {
param (
[string] $Source,
[string] $Target,
[string[]] $Filter
)
$ResolvedSource = Resolve-Path $Source
$NormalizedSource = $ResolvedSource.Path.TrimEnd([IO.Path]::DirectorySeparatorChar) + [IO.Path]::DirectorySeparatorChar
Get-ChildItem $Source -Include $Filter -Recurse | ForEach-Object {
$RelativeItemSource = $_.FullName.Replace($NormalizedSource, '')