Skip to content

Instantly share code, notes, and snippets.

View cuiwm's full-sized avatar
🎯
Focusing

cuiwm cuiwm

🎯
Focusing
  • UK
View GitHub Profile
@cuiwm
cuiwm / create_restore_dmg_macosx.md
Created March 10, 2023 11:49 — forked from disulfidebond/create_restore_dmg_macosx.md
Create or Restore Disk Image in Mac OSX

Overview

This gist details how to create or restore a disk image in Mac OSX. There are three methods that are described: Carbon Copy Cloner, Disk Utility, and CommandLine.

  • Disclaimer:
    • I have no financial incentives to https://bombich.com or Apple.
    • Always make a backup of your data, and make 2 separate backups before trying something new.
    • The following steps have been tested and are a summary of my personal recommendations, but should be used at your own risk.
    • If there is a chance of imminent data loss, contact a professional for assistance, and do not rely on a random person from the Internet for help.

Method 1: Carbon Copy Cloner (CCC)

const musicNotify = () => {
const m = '/storage/emulated/0/Download/WeiXin/平凡之路.mp3'
media.playMusic(m);
sleep(media.getMusicDuration());
}
const to_mall_cart = () => {
shopping_cart_btn=id('img_shopping_cart').findOne()
@cuiwm
cuiwm / http_streaming.md
Created December 29, 2021 08:12 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@cuiwm
cuiwm / 0-go-os-arch.md
Created November 24, 2021 09:19 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@cuiwm
cuiwm / plumbing.md
Created November 19, 2021 03:10 — forked from schacon/plumbing.md
plumbing cheat sheet

the plumbing commands

  • rev-parse [something]

    • show the SHA of any weird git phrase
  • hash-object -w [file]

    • take any file or stdin and return a blob sha
  • ls-tree (-r) [sha]

  • show the entries of a git tree in the db

@cuiwm
cuiwm / kubernetes_service_session_affinity.md
Created October 27, 2021 07:16 — forked from fjudith/kubernetes_service_session_affinity.md
Enable Session Affinity (a.k.a Sticky Session) to Kubernetes service
** Create swap **
- Check swap info
> swapon --show
> free -h
- Check available space disk
> df -h
- Create swap
> sudo fallocate -l 2G /swapfile
@cuiwm
cuiwm / add_remove_swap.sh
Created October 9, 2021 03:53 — forked from kselax/add_remove_swap.sh
shell script to add/remove swap for ubuntu 16.04
#!/bin/bash
add_remove_swap(){
echo "function add_remove_swap"
echo
local option[1]="add swap"
@cuiwm
cuiwm / parameters.conf.dist
Created September 3, 2021 07:26 — forked from AleksKu/parameters.conf.dist
lua openresty rabbitmq example
#RabbitMq
set $connect_rabbitMqStompHost "127.0.0.1";
set $connect_rabbitMqStompPort "61613";
set $connect_rabbitMqStompUsername "test";
set $connect_rabbitMqStompPassword "test";
set $connect_rabbitMqStompVhost "/";

Enable macOS Server Performance Mode

Performance mode changes the system parameters of your Mac. These changes take better advantage of your hardware for demanding server applications.

A Mac with macOS Server that needs to run high-performance services can turn on performance mode to dedicate additional system resources for server applications. Note, however, that performance mode can be enabled even without macOS Server being installed to achieve similar benifits for other high-performance services.

sudo nvram boot-args="serverperfmode=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"
sudo reboot

Reference: https://support.apple.com/en-us/HT202528.