Skip to content

Instantly share code, notes, and snippets.

View lotosbin's full-sized avatar
🏠
Working from home

bin^2 lotosbin

🏠
Working from home
View GitHub Profile
@lotosbin
lotosbin / hosts.ps1
Created December 20, 2012 15:08 — forked from markembling/hosts.ps1
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "$env:SystemRoot"+"\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
#!/bin/bash
# See for eg
# http://stackoverflow.com/questions/4526910/rename-a-git-submodule;
# an important point seems to be to avoiding the trailing '/' when
# calling 'add' in the new location.
# Also, note that the name ([submodule = "name"]) in the .gitmodules
# file can be anything; it's just used to map to the corresponding
# .git/config entry.
大致流程:
建立一个 Gist 账户。
安装package control
也可以安装package control组件,然后直接在线安装:
按Ctrl+`调出console
粘贴以下代码到底部命令行并回车:
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
重启Sublime Text 2。
'use strict';
/**
* ui-ladda
*
* To use, simply use normal Ladda classes and attributes and pass a model to ui-ladda. You can
* use truthy or falsey values, or pass decimals from 0 to 1 to show the progress bar animation.
*
*
* @param uiLadda (mixed): Sets wether or not to show the ladda loading
@lotosbin
lotosbin / app.js
Last active December 21, 2015 16:18 — forked from eperedo/app.js
use module
var app = angular.module('plunker', ['LaddaDirective']);
app.controller('MainCtrl', function($scope, $timeout) {
$scope.save = function(){
$scope.loading = true;
$timeout(function(){
$scope.loading = false;
}, 3000);
};
// file upload controller
function FileUploadCtrl($scope) {
//when upload finished
$scope.uploadFinished=function(e,data){
console.log(e)
console.log(data)
};
/**
* jQuery MD5 hash algorithm function
*
* <code>
* Calculate the md5 hash of a String
* String $.md5 ( String str )
* </code>
*
* Calculates the MD5 hash of str using the » RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash.
* MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash value. MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of data. The generated hash is also non-reversable. Data cannot be retrieved from the message digest, the digest uniquely identifies the data.
@lotosbin
lotosbin / html5.html
Created December 6, 2013 09:06
Html5:tempalte
<!DOCTYPE HTML>
<html>
<head>
<title></title>
</head>
<body></body>
</html>
@lotosbin
lotosbin / seajs.html
Created December 6, 2013 09:14
javascript:html:seajs
<!DOCTYPE HTML>
<html>
<head>
<title></title>
</head>
<body>
<script>
// seajs 的简单配置
seajs.config({
base: "./sea-modules/",

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&amp;login_password=xxx&amp;domain_id=xxx"