Skip to content

Instantly share code, notes, and snippets.

View enihsyou's full-sized avatar

九条涼果 enihsyou

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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
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 / 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>
@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) {
-- 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 */;