This file contains 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
// Changes XML to JSON | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { // element | |
// do attributes | |
if (xml.attributes.length > 0) { | |
//obj["attributes"] = {}; |
This file contains 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 | |
############################## | |
# Add sources | |
############################## | |
# google chrome stable | |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' |
This file contains 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
# follow other existing lines | |
# manipulation of virtual environments | |
venv() | |
{ | |
local venv_home | |
if [ -z $1 ]; then | |
if [ -d ".venv" ]; then | |
if [ -L ".venv" ]; then | |
venv_home=$(readlink -f ".venv") |
This file contains 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
#!/bin/sh | |
cpu_model='Unknown CPU' | |
cpu_cores='?' | |
if [ -r "/proc/cpuinfo" ]; then | |
cpu_model=$(cat /proc/cpuinfo | grep 'model name' | head -n 1 | sed 's/^.*:\s*//') | |
cpu_cores=$(cat /proc/cpuinfo | grep 'processor' | wc -l) | |
fi | |
mem_total='?G' | |
if [ -x "/usr/bin/free" ]; then |
This file contains 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
/****************************************************************************** | |
* Copyright (C) 2017 Yukai Miao <[email protected]> * | |
* * | |
* This program is free software; you can redistribute it and/or modify * | |
* it under the terms of the GNU General Public License as published by * | |
* the Free Software Foundation; either version 3 of the License, or * | |
* (at your option) any later version. * | |
* * | |
* This program is distributed in the hope that it will be useful, * | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
This file contains 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
<?php $title="File Index";?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1"> | |
<title><?=$title?></title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css"> |
This file contains 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
# Shell auto-completion for conda | |
# For Ubuntu, you may put this file in /etc/bash_completion.d/ or append the contents to ~/.bashrc | |
_conda_auto_comp() | |
{ | |
local cur opts | |
COMPREPLY=() | |
if [[ ${COMP_CWORD} == 1 ]]; then # list conda commands | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
opts="clean config create help info init install list package remove uninstall run search update upgrade activate deactivate" |
This file contains 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
#!/bin/bash | |
set -e | |
SERVER_PORT="8194" | |
WORK_DIR="$HOME/openvpn" | |
EASYRSA_VERSION="3.1.7" | |
EASYRSA_DIR="$WORK_DIR/EasyRSA-$EASYRSA_VERSION" | |
CLIENT_CONFIGS_DIR="$WORK_DIR/client-configs" |
This file contains 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
usecuda() | |
{ | |
export CUDA_VISIBLE_DEVICES=$1 | |
echo "Using cuda:$1" | |
} |
This file contains 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
#!/bin/bash | |
set -e | |
V2RAY_PORT=18900 | |
NGINX_PORT_RANGE="8900-8999" | |
CLIENT_CFG_OUTPUT_PATH=v2ray_client.json | |
printf "Please make sure the firewall rules for ports 80, 443, $NGINX_PORT_RANGE have been set!\n" |
OlderNewer