This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| type Nuclear struct { | |
| l sync.Mutex |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| timeout := make(chan bool, 1) | |
| ch := make(chan int) |
This file contains hidden or 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
| [Unit] | |
| Description=Blog (duguying's blog) | |
| After=syslog.target | |
| After=network.target | |
| #After=mysqld.service | |
| #After=postgresql.service | |
| #After=memcached.service | |
| #After=redis.service | |
| [Service] |
This file contains hidden or 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
| server { | |
| listen 80; | |
| server_name o.duguying.net; | |
| location / { | |
| try_files /_not_exists_ @backend; | |
| } | |
| location @backend { | |
| proxy_set_header X-Forwarded-For $remote_addr; |
This file contains hidden or 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 | |
| # | |
| # tomcat startup script for the Tomcat server | |
| # | |
| # chkconfig: 345 80 20 | |
| # description: start the tomcat deamon | |
| # | |
| # Source function library | |
| . /etc/rc.d/init.d/functions |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "github.com/codegangsta/inject" | |
| ) | |
| type SpecialString interface{} | |
| func Say(name string, gender SpecialString, age int) { |
This file contains hidden or 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
| $.fn.serializeObject = function() { | |
| var o = {}; | |
| var a = this.serializeArray(); | |
| $.each(a, function() { | |
| if (o[this.name]) { | |
| if (!o[this.name].push) { | |
| o[this.name] = [o[this.name]]; | |
| } | |
| o[this.name].push(this.value || ''); | |
| } else { |
This file contains hidden or 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
| import ( | |
| "bytes" | |
| "encoding/gob" | |
| ) | |
| func (this *Cache) encode(data interface{}) ([]byte, error) { | |
| buf := bytes.NewBuffer(nil) | |
| enc := gob.NewEncoder(buf) | |
| err := enc.Encode(data) | |
| if err != nil { |
This file contains hidden or 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
| $(window).keydown(function(event){ | |
| console.log(event.keyCode) | |
| }); |
This file contains hidden or 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
| private String readFileAsString(String filePath) throws IOException { | |
| StringBuffer fileData = new StringBuffer(); | |
| BufferedReader reader = new BufferedReader( | |
| new FileReader(filePath)); | |
| char[] buf = new char[1024]; | |
| int numRead=0; | |
| while((numRead=reader.read(buf)) != -1){ | |
| String readData = String.valueOf(buf, 0, numRead); | |
| fileData.append(readData); | |
| } |