Skip to content

Instantly share code, notes, and snippets.

View forecho's full-sized avatar
🎯
Focusing

蔡正海 forecho

🎯
Focusing
View GitHub Profile
@lexrus
lexrus / delete_all_imessage_conversations.applescript
Last active January 26, 2024 16:12
Delete all iMessage conversations. Compatible with macOS Monterey. Please check Reduce motion before launch this apple script.
# System Preferences -> Accessibility -> Display -> Reduce motion
tell application "Messages" to activate
tell application "Messages"
set chatCount to (count of chats)
end tell
tell application "System Events"
tell process "Messages"
@imdong
imdong / apple.js
Last active September 28, 2023 08:50
/**
* Apple Store 专卖店库存监控
*
* Docker:
* 前台运行 $ docker run --rm -it -v $(pwd):/app --name="apple" node:alpine node /app/apple.js
* 后台运行 $ docker run --rm -it -d -v $(pwd):/app --name="apple" node:alpine node /app/apple.js
* 后台时实时查看日志 $ docker logs -f -n 100 apple
*
* 需先: npm i axios
*
[V=browser-hello.mp4] Hi, I'm Matthew from OpenResty Inc. In this video, I'll demonstrate how to implement a "hello world" HTTP interface using OpenResty.
First of all, we make sure we are using OpenResty's nginx.
[delay=0] $ export PATH=/usr/local/openresty/nginx/sbin:$PATH
$ which nginx
[S] It's usually in this path.
And then we go to the home directory.
@MichaelBelgium
MichaelBelgium / wsl2-hosts-sync.ps1
Created June 5, 2020 07:46
WSL v2 windows hosts sync (powershell - updates domains to wsl2 ip)
# Requires -RunAsAdministrator
# Only works for WSL v2, this is completely not needed for WSL v1 where u always can use 127.0.0.1 in hosts file
Clear-Host
if ((Get-InstalledModule "Carbon" -ErrorAction SilentlyContinue) -eq $null) {
Install-Module -Name 'Carbon' -AllowClobber
}
Import-Module 'Carbon'
@ricardoaguiar
ricardoaguiar / Install and uninstall dnsmasq.md
Created April 15, 2020 16:43
Install and uninstall dnsmasq #Dnsmasq #TipsTricks

Install

  1. brew install dnsmasq
  2. cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf now this is automatically done by the dnsmasq installation
  3. Replace this in /usr/local/etc/dnsmasq.conf file:
address=/test/127.0.0.1
listen-address=127.0.0.1
  1. sudo mkdir -v /etc/resolver
  2. sudo touch /etc/resolver/test
@eusonlito
eusonlito / README.md
Last active March 15, 2024 15:01
Laravel Auth and Session without database. Using a remote API as Auth and Data provider.

This is an example of a web that uses a remote API as a database wrapper.

The remote API is stateless and the web uses cookies to maintain session persistence.

The API authentication endpoint returns a TOKEN that allows the web to make each request to the API with the user authentication header.


Este es un ejemplo de web que usa una API remota como wrapper de base de datos.

@terabytesoftw
terabytesoftw / gist:7ae1dc2b3bd6b852c4f89e056b323607
Last active December 20, 2022 14:05
Codeception For Tests Yii3.
#Add in your composer codeception tests.
$composer require codeception/codeception:^3.0
#Create your directory /tests in your proyect
$mkdir /tests
#Create codepction systems tests with namespaces
$vendor/bin/codecept bootstrap --namespace AppTests
#Custom options codeception.yml:
@zetavg
zetavg / sb-calibre-azw3-kindle.md
Last active April 11, 2024 19:14
直書書籍用 Calibre 轉 azw3 在 Kindle 上跑版(翻頁相反、字體走位)的解決方法。

直書書籍用 Calibre 轉 azw3 在 Kindle 上跑版的解決方法

圖為修正後範例。

有些直書書籍轉成 azw3 後排版會跑掉,在 Kindle 上僅剩翻頁變相反、從左到右的(因為原本是直書呀)。這裡是一些解決方法。

首先對要修正的書按右鍵選編輯,然後選 AZW3

1. 直書變橫書

@merikan
merikan / Jenkinsfile
Last active April 27, 2024 03:58
Some Jenkinsfile examples
Some Jenkinsfile examples
@slavafomin
slavafomin / 0-README.md
Last active March 15, 2023 13:35
Angular 2 match other field validator / Password match validator

Angular 2 match other field validator

This custom validator for Angular 4 allows you to have fields that must be equal to some other fields. Such validator is very useful for password confirmation validation, for example.

Besides checking if two values are matching, it also subscribes to changes from other control and re-validates when either of two controls is updated.

Usage