Skip to content

Instantly share code, notes, and snippets.

@bramblex
bramblex / open-termianl.txt
Last active September 15, 2017 01:36
open terminal
//osx
osascript -e 'tell application "Terminal" to do script "yes"'
//windows
start cmd /k echo Hello, World!
// linux
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;
template <class T, class E>
union ResultContent {
T data;
E error;
};
template<class T = bool, class E = bool>
struct Result {
protected:
bool ok;
// ==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==
@bramblex
bramblex / appify.sh
Last active October 12, 2017 05:50 — forked from anonymous/appify.sh
#!/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;
@bramblex
bramblex / appify.sh
Created October 12, 2017 06:43 — forked from oubiwann/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/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 {
#隐藏或者开启一个应用在 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
#!/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) => {
@bramblex
bramblex / mweb-auto-publish.sh
Last active January 29, 2023 08:23
mweb-auto-publish.sh
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!"
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) {"