Skip to content

Instantly share code, notes, and snippets.

@Luoyayu
Luoyayu / gist:3c5f099dd1a453f049fced1df7bc7964
Created December 12, 2019 18:48
extract Xcode.xip to a customed volume
By default, when extracts the Xcode.zip,
macos will create tmp file in `/private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T/com.apple.AUHelperService`.
Sometimes, the /private has no ehough space to hold 19GB Xcode.app.
Thus we can create a soft link named `com.apple.AUHelperService` in the tmp dir.
Steps:
1. BACKUP `com.apple.AUHelperService` in `/private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T/` to `com.apple.AUHelperService_BACKUP`
2. mkdir named `com.apple.AUHelperService` wherever you have enough space,
3. ln -s /your/absolute/path/com.apple.AUHelperService /private/var/folders/v2/tbmrn60d2910x3w23ys5fgs00000gn/T
4. double click the Xcode.xip
@Luoyayu
Luoyayu / mixin-example.dart
Last active March 6, 2022 10:24
Tour of Dart: A simple Mixin example about printer
/// Tour of Dart
/// A simple Mixin example about printer.
class Paper {
String sizeName = 'Paper';
// bool printable = false;
// Paper(this.sizeName, this.printable);
/// Here we don't care whether Paper can be printed,
@Luoyayu
Luoyayu / init.vim
Last active January 11, 2022 11:31
coc init.vim
" Plugin Manager
call plug#begin(expand('~/.vim/plugged'))
" 主题
Plug 'arcticicestudio/nord-vim'
Plug 'tpope/vim-sensible'
Plug 'liuchengxu/space-vim-theme'
" 格式工具
Plug 'Yggdroot/indentLine' " 缩进显示
Plug 'scrooloose/nerdcommenter' " 注释工具
@Luoyayu
Luoyayu / bear_autosave.scpt
Last active May 12, 2021 16:17
Bear writer: autosave to icloud
tell application "System Events"
-- 前提/premiss:
-- 1. 在iCloud云盘下新建Bear文件夹/Create a new folder "Bear" under the iCloud
-- 脚本做的事:/What the script does:
-- 1. 自动化点击/Automated click
@Luoyayu
Luoyayu / PKGBUILD
Last active September 12, 2020 07:03 — forked from EHfive/PKGBUILD
给VLC打补丁, 使flac网络文件/流的Content-Type始终为"audio/flac", 以"修复"网易云音乐获取的flac网络文件Content-Type为"audio/mpeg"而导致VLC不能正确识别文件而播放失败的问题
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Sarah Hay <sarahhay@mb.sympatico.ca>
# Contributor: Martin Sandsmark <martin.sandsmark@kde.org>
pkgname=vlc
_vlcver=3.0.6
# optional fixup version including hyphen
_vlcfixupver=
pkgver=${_vlcver}${_vlcfixupver//-/.r}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
// 根据先序遍历判断是否是完全二叉树,输入-1表示null
struct TreeNode {
int ch;
struct TreeNode *left;
struct TreeNode *right;
};
@Luoyayu
Luoyayu / toposort.cpp
Last active January 23, 2018 14:13
toposort
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;
std::vector<int> g[maxn], ans;
bool vis[maxn];
int indeg[maxn];
int n,m;
void toposort()
{
queue<int> q;
@Luoyayu
Luoyayu / find_cycle_in_graph.cpp
Last active January 18, 2018 09:11
find_all_cycle_in_graph_dfs
// 输出图中的所有的环
//color label :white(not visited),black(all children have been visited),gray(start visiting node)
// if one edge direct to a gray node means has cycle.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+3;
vector<int>g[maxn];
int vis[maxn];//0 while,1 gray, 2 black
int fa[maxn];
@Luoyayu
Luoyayu / AVL.cpp
Created January 3, 2018 08:42
AVL
#include <bits/stdc++.h>
using namespace std;
#define pass //
struct node
{
node *lc, *rc;
int key, color,height;
node(){}
node(int key):key(key){}
}*root;
@Luoyayu
Luoyayu / print_all_simple_path.cpp
Last active January 3, 2018 05:39
print_all_simple_path
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+7;
vector<int> ans, g[maxn];
bool vis[maxn];
void dfs(vector<int>p, int cur, int t) {
p.push_back(cur);
vis[cur] = 1;
if (cur == t) {
for (auto x:p) printf("%d ", x);