Skip to content

Instantly share code, notes, and snippets.

View Aileonzlc's full-sized avatar

Aileon Aileonzlc

View GitHub Profile
@Aileonzlc
Aileonzlc / DisplayMode.swift
Created October 21, 2025 03:21 — forked from bellbind/DisplayMode.swift
[macos][c]commandline for display and switch display mode
#!/usr/bin/env swift
// swiftc displaymode1.swift
import Foundation
import CoreGraphics
let display = CGMainDisplayID()
guard let dmodes = CGDisplayCopyAllDisplayModes(display, nil) as? [CGDisplayMode] else {exit(1)}
let argv = CommandLine.arguments
if argv.count == 2 {
@Aileonzlc
Aileonzlc / 1 - Either.cs
Created November 22, 2024 14:36 — forked from AlexeyRaga/1 - Either.cs
Either in C#
public abstract record Either<TLeft, TRight>
{
// there can be no more cases defined!
private Either() {}
public sealed record Left(TLeft Value) : Either<TLeft, TRight>;
public sealed record Right(TRight Value) : Either<TLeft, TRight>;
}
@Aileonzlc
Aileonzlc / HttpServer.cs
Created November 20, 2024 02:56 — forked from define-private-public/HttpServer.cs
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;
#! /usr/bin/swift
// Douglas Hill, March 2020
/*
Extracts the most common translations from Apple’s glossary files.
This script helped with localisation for KeyboardKit (https://github.com/douglashill/KeyboardKit) by leveraging Apple’s existing translations.
More detail in the article at https://douglashill.co/localisation-using-apples-glossaries/
#! /usr/bin/swift
// Douglas Hill, March 2020
// This file is made available under the MIT license included at the bottom of this file.
/*
Extracts specific localised strings from Apple’s glossary files.
This script helped with localisation for KeyboardKit (https://github.com/douglashill/KeyboardKit) by leveraging Apple’s existing translations.
@Aileonzlc
Aileonzlc / explore-localisation-glossaries.swift
Created November 5, 2024 09:16 — forked from douglashill/explore-localisation-glossaries.swift
Prints out translations from Apple’s glossary files matching text in a supplied English .strings file. Read more: https://douglashill.co/localisation-using-apples-glossaries/
#! /usr/bin/swift
// Douglas Hill, March 2020
// Prints out translations from Apple’s glossary files matching text in a supplied English .strings file.
// More detail in the article at https://douglashill.co/localisation-using-apples-glossaries/
import Foundation
let stringsSource = URL(fileURLWithPath: "PUT THE PATH TO YOUR ENGLISH .strings FILE HERE")
@Aileonzlc
Aileonzlc / MenuBarOptionKeyListener.swift
Created January 23, 2024 04:10 — forked from joncardasis/MenuBarOptionKeyListener.swift
Showing/Hiding Menu Bar Items If OPTION is held down (Swift macOS AppKit)
class AppDeleatate: NSObject, NSApplicationDelegate {
fileprivate var optionalMenuItems = [NSMenuItem]()
//...
func applicationDidFinishLaunching(_ aNotification: Notification) {
//...
let specialItem = NSMenuItem(title: MenuBarItemLabelText.specialItem, action: #selector(doNeatAction), keyEquivalent: "")
specialItem.isHidden = true
optionalMenuItems.append(specialItem)
@Aileonzlc
Aileonzlc / decode-json-swift.swift
Created April 27, 2023 03:15 — forked from mikebuss/decode-json-swift.swift
Decode [Any] and [String: Any] Swift 4
//
//
// Adapted from:
//
// Original: https://gist.github.com/loudmouth/332e8d89d8de2c1eaf81875cfcd22e24
// Adds encoding: https://github.com/3D4Medical/glTFSceneKit/blob/master/Sources/glTFSceneKit/GLTF/JSONCodingKeys.swift
// Adds fix for null inside arrays causing infinite loop: https://gist.github.com/loudmouth/332e8d89d8de2c1eaf81875cfcd22e24#gistcomment-2807855
//
struct JSONCodingKeys: CodingKey {
var stringValue: String

Linux 命令行编辑快捷键

初学者在Linux命令窗口(终端)敲命令时,肯定觉得通过输入一串一串的字符的方式来控制计算是效率很低。 但是Linux命令解释器(Shell)是有很多快捷键的,熟练掌握可以极大的提高操作效率。 下面列出最常用的快捷键,这还不是完全版。

  • 命令行快捷键:
    • 常用:
      • Ctrl L :清屏
  • Ctrl M :等效于回车