Skip to content

Instantly share code, notes, and snippets.

View enihsyou's full-sized avatar

九条涼果 enihsyou

View GitHub Profile
@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 s1131234@gmail.com
# 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
@enihsyou
enihsyou / Encryption-Decryption.java
Created November 27, 2019 17:15
Hyperskill Encryption-Decryption
package encryptdecrypt;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
public final class Main {
private Main() {}
@enihsyou
enihsyou / merlin_ss_decoder_n3ro.py
Created September 4, 2019 17:50
为梅林固件科学上网插件适配 N3RO 的 SIP002 URIs
from urllib.request import urlopen
from urllib.parse import unquote
import base64
import re
n3ro_rss_link = input("N3RO SIP002 URIs: ").strip()
data = urlopen(n3ro_rss_link).read()
links = base64.b64decode(data).decode()
for link in links.splitlines():
@enihsyou
enihsyou / _sign_helper.sh
Created June 7, 2019 20:36
一键创建SSL证书
#!/bin/bash
# CA文件夹目录
CA_HOME=${CA_HOME:?}
# CA配置文件
CA_CFG=${CA_CFG:?}
# CA证书路径
CA_CERT=${CA_CERT:?}
IDENTITY=${IDENTITY:?}
@enihsyou
enihsyou / backupRamDisk.sh
Last active March 18, 2020 15:45
Create a RamDisk backup DMG image on macOS, detail in Chinese 中文: https://enihsyou.com/2019/02/04/48
#!/usr/bin/env bash
DISKNAME=${1-RAM}
IMAGE_LOCATION=${2-"/Users/enihsyou/Library/RAM.dmg"}
DISK_LOCATION=/Volumes/${DISKNAME}
sudo hdiutil create -srcfolder $DISK_LOCATION $IMAGE_LOCATION -ov
sudo chown enihsyou $IMAGE_LOCATION