Skip to content

Instantly share code, notes, and snippets.

# Define your SSH public keys here
PUBLIC_KEYS=(
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAR3QrP/+QYeSAeF5OIEh5H0FJPFbZBVijsgP90Ug9Cq"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINs/phPOQePV+EM4SN8u9n7jrUw2Wg6eHvBholuExmJp Generated By Termius"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMFvJRAIEEUl9LEE4VfriJEkJA13Vpz7l5fUlllcz8DF FS_DE_BIG/Ansible"
)
# Create the .ssh directory if it doesn't exist
mkdir -p ~/.ssh
#!/bin/bash
# Define the path to the config file
CONFIG_FILE="/opt/nezha/agent/config.yml"
# Check if the config file exists
if [[ -f "$CONFIG_FILE" ]]; then
# Use sed to change disable_command_execute from false to true
sed -i 's/disable_command_execute: false/disable_command_execute: true/' "$CONFIG_FILE"
@Mez0
Mez0 / .bashrc
Created April 12, 2023 17:38 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@Mez0
Mez0 / UIVIewController+HideKeyboard.swift
Last active June 23, 2020 15:33
A UIViewController extension for dismissing keyboard
import UIKit
extension UIViewController {
func hideKeyboardWhenTappedAround() {
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard))
tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
}
@objc func dismissKeyboard() {
view.endEditing(true)
@Mez0
Mez0 / Date+Random.swift
Last active December 2, 2024 13:21
Swift Generate Random Date
extension Date {
static func random() -> Date {
let randomTime = TimeInterval(Int32.random(in: 0...Int32.max))
return Date(timeIntervalSince1970: randomTime)
}
}
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
def quicksort(a)
return a unless a.count > 1
pivot = a[0]
less = a.select {|num| num < pivot }
equal = a.select {|num| num == pivot }
greater = a.select {|num| num > pivot }
return quicksort(less) + equal + quicksort(greater)
end
@Mez0
Mez0 / hosts
Created September 25, 2017 03:32 — forked from alswl/hosts
hosts for OpenWRT, for disable AD in xiaomi TV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com
@Mez0
Mez0 / relaunch.scpt
Created August 28, 2016 03:10
relaunch Finder with AppleScript
try
tell application "Finder" to quit
end try
delay 2
tell application "Finder" to activate