Skip to content

Instantly share code, notes, and snippets.

View Butanediol's full-sized avatar
🔜
S∞n

丁二 Butanediol

🔜
S∞n
View GitHub Profile
@Butanediol
Butanediol / ip_geolocation_analyzer.py
Created February 3, 2025 08:44
Python script for analyzing IP addresses using MaxMind's GeoLite2 database. Maps IPs to countries and generates geographical distribution statistics. Includes error handling and command-line arguments support.
import argparse
from collections import defaultdict
from typing import Dict, List
import urllib.request
import os
import geoip2.database
from geoip2.errors import AddressNotFoundError
#SingleInstance
; Ctrl + F11 = Always on top
^F11::{
WinSetAlwaysOnTop -1, "A"
TrayTip "Always on top", "Toggled", ""
}
; Delete to ...
!Backspace:: Send "{Shift Down}+{Home}+{Backspace}+{Shift Up}"
@Butanediol
Butanediol / jdt_format_profile.xml
Last active September 28, 2023 02:51
JDT Format Profile
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
<profile kind="CodeFormatterProfile" name="GoogleStyle" version="13">
</profile>
</profiles>816703<?xml version="1.0" encoding="utf-8"?>
<profiles version="21">
<profile kind="CodeFormatterProfile" name="Default" version="21">
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>

My Snippets

ZSH

Install oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Install fast-syntax-highlighting

@Butanediol
Butanediol / TOCropper.swift
Last active May 14, 2022 15:56
TOCropView wrapper for SwiftUI
//
// TOCropper.swift
// PhotoPicker
//
// Created by Butanediol on 7/12/2021.
//
import SwiftUI
import TOCropViewController
@Butanediol
Butanediol / MantisImageCropper.swift
Created December 7, 2021 10:54
A SwiftUI wrapper for Mantis image cropper.
//
// ImageCropper.swift
//
//
// Created by Butanediol on 7/12/2021.
//
import SwiftUI
import Mantis
@Butanediol
Butanediol / colors
Created August 19, 2020 03:07
my color profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.18094024062156677</real>
@Butanediol
Butanediol / rss2magnets.py
Last active July 2, 2022 05:58
从 RSS 订阅中提取磁链接
from xml.etree.ElementTree import parse
import requests
import argparse
import os
import re
parser = argparse.ArgumentParser(description="Fetch all magnet urls from RSS subsription.")
parser.add_argument("-o", "--output", type=str, default='', help="Set output file name. [default: mangets.txt]")
parser.add_argument('-k', "--keep", dest='keep_sub', action='store_true', help="Save RSS file.")
parser.add_argument("url", nargs=1, help="You must provide a subsription url.")
[
{
"name": "Clue 1",
"author": "Oblatum",
"url": "https://img.vim-cn.com/11/a0cbeac5e622a6ab21d552423caf4fed6f529d.png"
},
{
"name": "Clue 2-1",
"author": "Oblatum",
"url": "https://img.vim-cn.com/dc/dd2cff855282edec18710a417449d290f4035b.png"