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 / install-pwsh.sh
Last active October 15, 2019 13:17
Install PowerShell on Debian-based distro (based on downloaded sources.list)
sudo apt-get update
sudo apt-get install -y wget gnupg apt-transport-https
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/microsoft.list https://packages.microsoft.com/config/$(. /etc/os-release && echo $ID/$VERSION_ID)/prod.list
sudo apt-get update
sudo apt-get install -y powershell
@Himura2la
Himura2la / Dockerfile
Last active November 18, 2019 08:54
cron in docker
FROM debian
RUN apt-get update && apt-get install cron -y
RUN echo '* * * * * echo "[$(date -Is)] Job fired!" > /proc/1/fd/1 2>/proc/1/fd/2' | crontab
CMD ["cron", "-f"]
@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 / 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 / manual_display_config.sh
Last active October 15, 2020 21:34
Add a resolution to "Unknown Display"
#!/bin/sh
get_xorg_conf() {
local usage="Usage: ${FUNCNAME[0]} monitor horizontal_resolution vertical_resolution refresh_rate"
local mon=${1?$usage}
local X=${2?$usage}
local Y=${3?$usage}
local refresh=${4?$usage}
local cvt="$(cvt $X $Y $refresh)"
@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