Skip to content

Instantly share code, notes, and snippets.

View enihsyou's full-sized avatar

九条涼果 enihsyou

View GitHub Profile
@enihsyou
enihsyou / 获取移动光猫H2-2管理员密码.md
Last active July 18, 2025 14:39
获取移动光猫 H2-2 管理员密码 ver.2022-04

长话短说,直接列出操作方法。求解过程用到的阅读链接放在最后

适用型号

设备名称:吉比特无源光纤接入用户端设备(GPON ONU)
设备类型:中国移动智能家庭网关 类型二
设备型号:H2-2
生产日期:2021/03

[!IMPORTANT]

@enihsyou
enihsyou / ligatures.py
Created November 19, 2021 15:29
Disable font ligatures on iTerm2 by monitoring on window size change
#!/usr/bin/env python3.7
# This script monitoring iTerm2 window state,
# disable font-ligatures when window size is big enough to drag FPS down,
# and (re-)enable ligatures when window size shrinks to acceptance range.
# Put this script under AutoLaunch folder to launch automatically when iTerm2 starts,
# as described at https://iterm2.com/python-api/tutorial/running.html#auto-run-scripts
import asyncio
import iterm2
-- MySQL dump 10.13 Distrib 5.7.34, for osx10.16 (x86_64)
--
-- Host: 127.0.0.1 Database: playground
-- ------------------------------------------------------
-- Server version 5.7.34
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@enihsyou
enihsyou / iterate-slice-in-chunk.go
Created December 17, 2020 10:18
How to iterate through slice in chunk
// int64 version, iterate through slice in chunk, breaks on first error.
func IterateSliceInChunk(slice []int64, chunkSize int, work func([]int64) error) error {
if chunkSize < 1 {
panic("chunk size is below one")
}
var offset = 0
var err error
for err == nil {
lower, upper := offset, offset+chunkSize
if upper >= len(slice) {
@enihsyou
enihsyou / JetBrains Language Injection.xml
Created November 3, 2020 10:43
Custom language injection settings for Jetbrains platform
<LanguageInjectionConfiguration>
<injection language="XPath" injector-id="python">
<display-name>XPath</display-name>
<place><![CDATA[pyLiteralExpression().and(pyMethodArgument("xpath", 0, "lxml.etree._Element._Element"))]]></place>
</injection>
</LanguageInjectionConfiguration>
USERNAME=enihsyou
mkdir -p ~/.ssh
if ! [[ -f ~/.ssh/authorized_keys ]]; then
echo "Creating new ~/.ssh/authorized_keys"
touch ~/.ssh/authorized_keys
fi
keys=`curl https://api.github.com/users/$USERNAME/keys | grep -o -E "ssh-\w+\s+[^\"]+"`
@enihsyou
enihsyou / DefaultKeyBinding.Dict
Created July 22, 2020 06:20
My DefaultKeyBinding.dict for macOS
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@enihsyou
enihsyou / Lockback XML Full Caller.xml
Created February 18, 2020 08:34
IntelliJ file templates for own usage.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %highlight(%-5level) %white(-) %black(%msg)
%white(%replace(%caller{3}){'Caller\+\d\t', ' '})</pattern>
</encoder>
</appender>
@enihsyou
enihsyou / maze.py
Last active February 9, 2020 05:19
盲目搜索之宽度优先搜索算法Solution for https://pad.251.sh/s/jcS1ea2t5
# -*- coding:utf-8 -*-
# Problem: https://pad.251.sh/s/jcS1ea2t5
# Author: Kujo Ryoka
from unittest import TestCase
class Maze:
def __init__(self, map, n, m, x, y):
self.ans = 0 # 最短步长结果
@enihsyou
enihsyou / split_tunneling.sh
Created December 20, 2019 08:04
Network tweaking script to make Internet access available while connection to Danone Pulse Secure VPN (Split tunneling).
#! /usr/bin/env bash
# Author: Ryoka Kujo [email protected]
# Descripthon: Network tweaking script to make Internet access available
# while connection to Pulse Secure VPN.
# network interface list can be retrieved by `networksetup -listallhardwareports`
# specify your network interface for internet access.
PUBLIC_INTERFACE=en7
# specify your network interface for VPN tunnel access.
TUNNEL_INTERFACE=utun2