修正 Sketch-Base64-PNG-Export 的錯誤

img

前陣子收到一個很久以前寫的sketch外掛
網友通報的bug,掛了很久,直到最近才有空修正

Do not copy the code. #3

主要的問題,是因為 CocoaScript 的語法又改了
所以要替換一下寫法
主要的問題來自這兩段語法

1
2
var rect = [MSSliceTrimming trimmedRectForSlice:layer];
var slice = [MSExportRequest requestWithRect:rect scale:1];

改成

1
2
var rect = [[MSSliceTrimming trimmedRectForLayerAncestry:[MSImmutableLayerAncestry ancestryWithMSLayer:layer]]];
var slice = [[MSExportRequest exportRequestsFromExportableLayer:layer] firstObject];

其餘的功能就會正常了 :)

留言與分享

翻了很多文章,取出最後精華在這

有空再來整理

安裝佈景主題

  1. 先 fork 一份,修改的時候才能 commit 到自己的 respostory

例如:安裝 tranquilpeak

1
git submodule add git@github.com:jawayang/hexo-theme-tranquilpeak.git themes/tranquilpeak
  1. 處理 submodules 的時候會遇到權限問題
    1
    2
    3
    4
    5
    Submodule 'themes/tranquilpeak' (git@github.com:jawayang/hexo-theme-tranquilpeak.git) registered for path 'themes/tranquilpeak'
    Cloning into 'themes/tranquilpeak'...
    Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
    Permission denied (publickey).
    fatal: Could not read from remote repository.

參考:http://stackoverflow.com/questions/15674064/github-submodule-access-rights-travis-ci

改用 修改 .gitmodules 的設定
把 url 從 ssh 改成 https 的方式
並且加上

1
2
git:
submodules: false

用手動的方式執行

留言與分享

備份哪些資料?

gitlab 上有哪些重要的資料是應該備份的呢?

  1. gitlab 設定檔
  2. 專案資料

備份 gitlab 設定檔

1
2
# 備份資料會放在 /var/opt/gitlab/backups
sudo sh -c 'umask 0077; tar -cf $(date "+/var/opt/gitlab/backups/gitlabconfig-%s.tar") -C / etc/gitlab'

備份 gitlab 專案

1
2
# 備份資料會放在 /var/opt/gitlab/backups.
/opt/gitlab/bin/gitlab-rake gitlab:backup:create

切換身份並設定排程

讓 linux 可以自動定時執行 script

1
2
3
4
# 切換身份執行
sudo crontab -e -u root
# 設定定時工作
15 04 * * 2-6 umask 0077; tar -cf $(date "+/var/opt/gitlab/backups/gitlabconfig-%s.tar") -C / etc/gitlab

同步資料夾到 NAS 中

1
2
3
4
5
#!/usr/bin/bash
cd /home/git/gitlab
fn=`sudo -u git -H rake RAILS_ENV=production gitlab:backup:create | grep 'Creating backup archive:' | awk '{print $4}'`
scp /home/git/gitlab/tmp/backups/$fn root@x.y.z.a:/root/backups/
echo "Backed up file /home/git/gitlab/tmp/backups/$fn to root@x.y.z.a.."

如何設定 SCP

如何設定 rsync

1
rsync -av /var/gitlabBackup/ username@10.1.1.31::IT\ Resources/gitlabBackup

上面的設定都免了直接設定 NFS 就好了,直接備份到 NFS 上

NFS 設定方式

NFS client

執行 mount

1
sudo mount 10.1.1.31:/volume1/NetBackup /mnt/

發生錯誤

1
2
3
4
5
6
mount: wrong fs type, bad option, bad superblock on 10.1.1.31:/volume1/NetBackup,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so

原來是需要安裝 nfs 的套件

1
sudo apt-get install nfs-common

然後就可以掛載

1
sudo mount 10.1.1.31:/volume1/NetBackup gitlabBackup/

掛載前還需要先建立資料夾

1
mkdir gitlabBackup

結論

綜合以上的文獻資料,具體的作法:

  1. 先將 NAS 資料夾掛接到 Gitlab Server
  2. 透過 crontab 設定工作排程
  3. 完成

留言與分享

ubuntu 安裝 Fish shell

> 詳細教學 install-fish-shell-mac-ubuntu

1
sudo apt-add-repository ppa:fish-shell/release-2

遇到:執行 add-apt-repository 指令之後,出現「Command not found」的訊息
解決方式

1
apt-get install software-properties-common

然後升級 apt-get 然後 install

1
2
sudo apt-get update
sudo apt-get install fish

把 Fish 設定為預設 shell 工具:

1
chsh -s /usr/bin/fish

升級 apt ( Advanced Packaging Tools )

1
apt-get update
1
apt-get upgrade

升級 git

1
2
3
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

安裝 OMF

1
2
curl -L https://get.oh-my.fish > install
fish install --path=~/.local/share/omf --config=~/.config/omf

安裝主題

1
2
3
4
omf install bobthefish
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v1.0.0/FiraCode.zip
sudo unzip FiraCode.zip -d /usr/local/share/fonts/
sudo fc-cache -fv

留言與分享

  • 第 1 頁 共 1 頁
作者的圖片

James Yang

author.bio


author.job