Skip to content

Instantly share code, notes, and snippets.

View tacahiroy's full-sized avatar
🐑

Takahiro Yoshihara tacahiroy

🐑
  • Karabiner Software
  • Tokyo, JAPAN
  • 15:28 (UTC +09:00)
  • X @tacahiroy
View GitHub Profile
@tacahiroy
tacahiroy / request.py
Created November 5, 2020 05:25
Get something using HTTPS with Basic auth via SOCKS5 proxy in Python 3.x
import sys
import requests
if __name__ == "__main__":
res = requests.get(
"https://foo.local/",
auth=("user", "password"),
proxies={
@tacahiroy
tacahiroy / fstab
Created October 23, 2020 08:42
Mount the remote filesystem using sshfs that shared with all other users
USER@REMOTE-SERVER:/share /mnt/share fuse.sshfs defaults,idmap=user,allow_other,reconnect,ServerAliveInterval=120,TCPKeepAlive=yes,Compression=yes,IdentityFile=/root/.ssh/id_ed25519
@tacahiroy
tacahiroy / git_default_branch_for_bare_repo.sh
Created October 2, 2020 12:45
To change the default branch for the bare repository in Git
# https://stackoverflow.com/a/3302018/1431621
git symbolic-ref HEAD refs/heads/mybranch
@tacahiroy
tacahiroy / prompt_colors.sh
Created September 28, 2020 06:32
Colour codes for Bash prompt
# https://linoxide.com/how-tos/change-linux-shell-prompt-with-different-colors/
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
@tacahiroy
tacahiroy / recover_from_fork_bomb.sh
Created September 28, 2020 00:59
Recovery from bash fork retry: no child processes
#!/bin/bash
# https://superuser.com/a/168805/613038
kill -STOP -u USER-NAME
kill -KILL -u USER-NAME
@tacahiroy
tacahiroy / ubuntu-libc-not-found-error.md
Last active June 11, 2024 07:43
The resolution for apt failured due to error processing package libc-bin
sudo apt install -y foo
...
Setting up libc-bin (2.31-0ubuntu9) ...
Aborted (core dumped)
/sbin/ldconfig.real: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib' given more than once
@tacahiroy
tacahiroy / profiles.json
Last active September 3, 2020 07:22
Sample configuration file for Windows Terminal 1.3.2382.0
// This file was initially generated by Windows Terminal Preview 1.1.1812.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@tacahiroy
tacahiroy / RedHat.yml
Created November 11, 2019 03:16
Set variable when the target vesion is EL 7
ansible_distribution_major_version_when_var_is_7:
my_packages: "{{ lookup('flattened', my_packages, 'ShellCheck') }}"
@tacahiroy
tacahiroy / run_el8_only.yml
Created November 11, 2019 03:09
Proceed an Ansible task when the target is EL 8 (RHEL or CentOS)
when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "8"
@tacahiroy
tacahiroy / repoquery.sh
Last active November 7, 2019 03:28
List contents of a package in CentOS 8
sudo dnf install -y dnf-utils
repoquery -l some-package