This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //osx | |
| osascript -e 'tell application "Terminal" to do script "yes"' | |
| //windows | |
| start cmd /k echo Hello, World! | |
| // linux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <class T> | |
| struct Segment { | |
| private: | |
| unsigned long start; | |
| unsigned long _size; | |
| std::vector<T>* content; | |
| public: | |
| Segment(std::vector<T> &content){ | |
| this->content = &content; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <class T, class E> | |
| union ResultContent { | |
| T data; | |
| E error; | |
| }; | |
| template<class T = bool, class E = bool> | |
| struct Result { | |
| protected: | |
| bool ok; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name fuck网易 | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match http://mc.netease.com/* | |
| // @grant none | |
| // @require http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js | |
| // ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # appify your-shell-script.sh "Your App Name" | |
| # https://mathiasbynens.be/notes/shell-script-mac-apps | |
| APPNAME=${2:-$(basename "${1}" '.sh')}; | |
| DIR="${APPNAME}.app/Contents/MacOS"; | |
| if [ -a "${APPNAME}.app" ]; then | |
| echo "${PWD}/${APPNAME}.app already exists :("; | |
| exit 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| VERSION=4.0.1 | |
| SCRIPT=`basename "$0"` | |
| APPNAME="My App" | |
| APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns" | |
| OSX_VERSION=`sw_vers -productVersion` | |
| PWD=`pwd` | |
| function usage { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #隐藏或者开启一个应用在 docker 上的图标 | |
| /usr/libexec/PlistBuddy -c "Add :LSUIElement bool true" /Applications/iTerm.app/Contents/Info.plist | |
| /usr/libexec/PlistBuddy -c "Delete :LSUIElement" /Applications/iTerm.app/Contents/Info.plist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| const fs = require('fs') | |
| const path = require('path') | |
| const [, , ...argv] = process.argv | |
| const create_body_flag = argv.filter(key => key === '-b').length > 0 | |
| const classes = argv.filter(key => key !== '-b') | |
| const warpNamespace = (namespaces, content) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (pbpaste | grep -Eq '^cd "[^"]*" && sh "[^"]*/site_publish_logs/sh_\d*\.sh" && open "[^"]*"') | |
| then | |
| echo "========== MWEB AUTO PUBLISH START ==========" | |
| echo "Runing command:" | |
| pbpaste | |
| if pbpaste | sh | |
| then | |
| echo "Success!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function startup(zone, module_path) { | |
| const code | |
| = "eval((function () {" | |
| + " var path = require('path');" | |
| + " var startup_module_path = " + JSON.stringify(module_path) + ";" | |
| + " var startup_module = require(startup_module_path);" | |
| + " var startup_code = Object" | |
| + " .getOwnPropertyNames(startup_module)" | |
| + " .map(function (name) { return { name: name, value: startup_module[name] }; })" | |
| + " .reduce(function (prev, curr) {" |