Skip to content

Instantly share code, notes, and snippets.

wget http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt
sudo mv add-apt-repository.sh.txt /usr/sbin/add-apt-repository
sudo chmod o+x /usr/sbin/add-apt-repository
sudo chown root:root /usr/sbin/add-apt-repository
sudo add-apt-repository ppa:webupd8team/sublime-text-2
@lidaling
lidaling / login.js
Created May 6, 2014 02:40
js section
var Login={};
Login=(function(){
var LOGIN_URL="/user/account/login";
return{
init:function(){
},
bindEvents:function(){
$(".login-bt").click(function(){
var loginName=$(".loginName").val();
@lidaling
lidaling / login.js
Created May 6, 2014 02:40
js section
var Login={};
Login=(function(){
var LOGIN_URL="/user/account/login";
return{
init:function(){
},
bindEvents:function(){
$(".login-bt").click(function(){
var loginName=$(".loginName").val();
'use strict';
var
LIVERELOAD_PORT = 35729,
lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT }),
mountFolder = function( connect, dir ) {
return connect.static(require('path').resolve(dir));
};
module.exports = function( grunt ) {
<snippet>
<content><![CDATA[base(this, '${1:method}'${2});${0}]]></content>
<tabTrigger>base</tabTrigger>
<scope>source.js</scope>
<description>Base method call</description>
</snippet>
@lidaling
lidaling / gist:597cf0b73a2e1429908b
Created March 13, 2015 06:10
vim ctags install
sudo apt-get install exuberant-ctags
@lidaling
lidaling / dateconvert.py
Created October 29, 2015 09:01
python date convert
1.将字符串的时间转换为时间戳
方法:
a = "2013-10-10 23:40:00"
将其转换为时间数组
import time
timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S")
转换为时间戳:
timeStamp = int(time.mktime(timeArray))
timeStamp == 1381419600
2.字符串格式更改
@lidaling
lidaling / gist:5e1f01bd60b2b4877a1982a6a1262ccc
Created September 9, 2016 05:47 — forked from tnolet/gist:7361441
Install collectd 5.4 on Centos 6.x and make it spit out cool metrics. Copied from http://linuxdrops.com/install-collectd-statistics-collecter-on-centos-rhel-ubuntu-debian/ and tweaked for your and my pleasure. For all other cool options, check the provided link.
#!/bin/bash
# Perform installation as root
# Install prereqs
yum -y install libcurl libcurl-devel rrdtool rrdtool-devel rrdtool-prel libgcrypt-devel gcc make gcc-c++
# Get Collectd, untar it, make it and install
wget http://collectd.org/files/collectd-5.4.0.tar.gz
tar zxvf collectd-5.4.0.tar.gz
@lidaling
lidaling / Application.scala
Created December 7, 2016 01:51 — forked from Lobedan/Application.scala
Spring-Boot-Application Integration Test in scala
object Application {
def main(args: Array[String]) : Unit = SpringApplication.run(classOf[ApplicationConfig], args :_ *)
}
@lidaling
lidaling / SpringContextTests.scala
Created September 1, 2017 06:06 — forked from shishkin/SpringContextTests.scala
Spring annotation-based configuration with ScalaTest
package samples
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest._
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation._
import org.springframework.stereotype.Service
import org.springframework.test.context.support.AnnotationConfigContextLoader
import org.springframework.test.context.{ActiveProfiles, ContextConfiguration, TestContextManager}