Skip to content

Instantly share code, notes, and snippets.

View elfgzp's full-sized avatar
☸️
working and learning

Elf elfgzp

☸️
working and learning
View GitHub Profile
@elfgzp
elfgzp / torndb.ex.py
Created January 10, 2017 02:21 — forked from damozhang/torndb.ex.py
Examples of that how to use Torndb.
import torndb
mysql_settings = {
'host': 'localhost:3306',
'user': 'user',
'password': 'password',
'database': 'database',
'time_zone': '-8:00',
'charset': 'utf8'
# Install java and make sure JAVA_HOME is properly set.
# Make sure those dependencies are present:
sudo apt-get install g++ uuid-dev libtool autoconf automake
cd ~
# install zeromq
wget http://download.zeromq.org/zeromq-2.1.7.tar.gz
tar -xzf zeromq-2.1.7.tar.gz
@elfgzp
elfgzp / VuePahoMqtt.js
Created December 20, 2018 01:28
👻Vue.js Mqtt client
/*******************************************************************************
* Copyright (c) 2013 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
class TestCase(TransactionTestCase):
"""
Similar to TransactionTestCase, but use `transaction.atomic()` to achieve
test isolation.
In most situations, TestCase should be preferred to TransactionTestCase as
it allows faster execution. However, there are some situations where using
TransactionTestCase might be necessary (e.g. testing some transactional
behavior).
@elfgzp
elfgzp / leetcode_tree.py
Last active February 13, 2019 15:03
use to generate leetcode tree用于生成 leetcode 题目中的树 用于测试
# -*- coding: utf-8 -*-
__author__ = 'gzp'
import json
from copy import copy
class ListNode(object):
def __init__(self, x):
module.exports = {
/** 区分打包环境与开发环境
* process.env.NODE_ENV==='production' (打包环境)
* process.env.NODE_ENV==='development' (开发环境)
* baseUrl: process.env.NODE_ENV==='production'?"https://cdn.didabisai.com/front/":'front/',
*/
// 基本路径
baseUrl: '/',
// 输出文件目录
outputDir: 'dist',
@elfgzp
elfgzp / ant
Created January 23, 2019 07:48
default.less
/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
@import '../color/colors';
// The prefix to use on all css classes from ant.
@ant-prefix : ant;
// -------- Colors -----------
@primary-color : @blue-6;
@info-color : @blue-6;
@success-color : @green-6;
# -*- coding: utf-8 -*-
__author__ = 'gzp'
from django.core.management import call_command
from django.db import DEFAULT_DB_ALIAS, connections, transaction
from django.test.testcases import TransactionTestCase
class TestCase(TransactionTestCase):
"""
#=============================================================================
# dark_powered.toml --- dark powered configuration example for SpaceVim
# Copyright (c) 2016-2017 Wang Shidong & Contributors
# Author: Wang Shidong < wsdjeg at 163.com >
# URL: https://spacevim.org
# License: GPLv3
#=============================================================================
# All SpaceVim option below [option] section
[options]
list=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt|awk NF|sed ":a;N;s/\n/,/g;ta"`
if [ -z "`grep "bt-tracker" /root/.aria2/aria2.conf`" ]; then
sed -i '$a bt-tracker='${list} /root/.aria2/aria2.conf
echo add......
else
sed -i "s@bt-tracker.*@bt-tracker=$list@g" /root/.aria2/aria2.conf
echo update......
fi