sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
| #!/usr/bin/env osascript -l JavaScript | |
| const App = Application.currentApplication(); | |
| App.includeStandardAdditions = true; | |
| const kCFPrefsFeatureFlagsDir = '/Library/Preferences/FeatureFlags/Domain'; | |
| const kCFPrefsFeatureEnabledKey = 'Enabled'; | |
| const kUIKitDomainPrefsTemporaryPath = '/tmp/UIKit.plist'; | |
| const kUIKitRedesignedTextCursorKey = 'redesigned_text_cursor'; |
| from sklearn.datasets import load_digits | |
| X, y = load_digits().data, load_digits().target | |
| from cuml.manifold import TSNE | |
| tsne = TSNE(n_components = 2) | |
| X_hat = tsne.fit_transform(X) | |
| # To plot the embedding | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| plt.scatter(X_hat[:,0], X_hat[:,1], c = y, s = 0.5) |
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| get_ipython().run_line_magic('pylab', 'inline') | |
| import torch | |
| def jaccard_distance_loss(y_true, y_pred, smooth=100): | |
| """ | |
| Jaccard = (|X & Y|)/ (|X|+ |Y| - |X & Y|) | |
| = sum(|A*B|)/(sum(|A|)+sum(|B|)-sum(|A*B|)) | |
| #!/usr/bin/env python | |
| # -*- coding:UTF-8 -*- | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.init as init | |
| def weight_init(m): | |
| ''' |
On receiving NAS:
setcfg LOGIN "SSH AllowTcpForwarding" TRUE
reboot
On client to forward local port 8443 to the QNAP admin interface:
ssh user@host -L 8443:localhost:443
Note: This is the guide for v 2.x.
For the v3, please follow this url: https://blog.csdn.net/sam_shan/article/details/80585240 Thanks @liy-cn for contributing.
For the v6, please follow the comment below: https://gist.github.com/trandaison/40b1d83618ae8e3d2da59df8c395093a?permalink_comment_id=5079514#gistcomment-5079514
Download: StarUML.io
| # Output a single frame from the video into an image file: | |
| ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png | |
| # Output one image every second, named out1.png, out2.png, out3.png, etc. | |
| # The %01d dictates that the ordinal number of each output image will be formatted using 1 digits. | |
| ffmpeg -i input.mov -vf fps=1 out%d.png | |
| # Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc. | |
| # The %02d dictates that the ordinal number of each output image will be formatted using 2 digits. | |
| ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg |
| #! /usr/bin/env bash | |
| current_folder=`osascript -e 'tell application "Finder"' -e "if (${1-1} <= (count Finder windows)) then" -e "get POSIX path of (target of window ${1-1} as alias)" -e 'else' -e 'get POSIX path of (desktop as alias)' -e 'end if' -e 'end tell'` | |
| newest_file=`mdls -name kMDItemFSName -name kMDItemDateAdded -raw /Users/YOUR_USERNAME_HERE/Downloads/* | xargs -0 -I {} echo {} | sed 'N;s/\n/ /' | sort --reverse | head -1 | sed -E "s/^.*\\+0000 //"` | |
| mv "/Users/YOUR_USERNAME_HERE/Downloads/$newest_file" "$current_folder" | |
| osascript -e "display notification \"$newest_file → $current_folder\" with title \"File moved\"" |
| # clang-format | |
| # Made by: Ingmar Delsink | |
| # https://ingmar.dels.ink | |
| # See http://clang.llvm.org/docs/ClangFormatStyleOptions.html | |
| # Tested with: clang-format version 3.7.1 | |
| # General | |
| ######### | |
| # The style used for all options not specifically set in the configuration. |