first commit
commit
36065e83e4
@ -0,0 +1,80 @@
|
|||||||
|
<pre>
|
||||||
|
<a href="68000.pdf">68000.pdf</a>
|
||||||
|
<a href="Addison.Wesley.OpenGL.Programming.Guide.8th.Edition.Mar.2013.ISBN.0321773039.pdf">Addison.Wesley.OpenGL.Programming.Guide.8th.Edition.Mar.2013.ISBN.0321773039.pdf</a>
|
||||||
|
<a href="GenesisSoftwareManual.pdf">GenesisSoftwareManual.pdf</a>
|
||||||
|
<a href="Hoare78.pdf">Hoare78.pdf</a>
|
||||||
|
<a href="No.Starch.Absolute.FreeBSD.The.Complete.Guide.To.FreeBSD.2nd.Edition.Nov.2007.ISBN.1593271514.pdf">No.Starch.Absolute.FreeBSD.The.Complete.Guide.To.FreeBSD.2nd.Edition.Nov.2007.ISBN.1593271514.pdf</a>
|
||||||
|
<a href="Objective-C%20For%20Dummies">Objective-C For Dummies</a>
|
||||||
|
<a href="Objective-C%20Programming%20The%20Big%20Nerd%20Ranch%20Guide%202011.pdf">Objective-C Programming The Big Nerd Ranch Guide 2011.pdf</a>
|
||||||
|
<a href="Programming%20in%20Objective-C%20-%206th%20Edition.pdf">Programming in Objective-C - 6th Edition.pdf</a>
|
||||||
|
<a href="The%20Book%20of%20Ruby%20-%20A%20Hands-On%20Guide%20for%20the%20Adventurous.pdf">The Book of Ruby - A Hands-On Guide for the Adventurous.pdf</a>
|
||||||
|
<a href="The%20GNU%20Make%20Book.pdf">The GNU Make Book.pdf</a>
|
||||||
|
<a href="Virtual%20Memory.html">Virtual Memory.html</a>
|
||||||
|
<a href="adevelopersguidetonetinazure.pdf">adevelopersguidetonetinazure.pdf</a>
|
||||||
|
<a href="airevolutioninmedicine_V2.pdf">airevolutioninmedicine_V2.pdf</a>
|
||||||
|
<a href="airevolutioninnetworkingsecurityandemergingtechnologies.pdf">airevolutioninnetworkingsecurityandemergingtechnologies.pdf</a>
|
||||||
|
<a href="airevolutioninprojectmanagement.pdf">airevolutioninprojectmanagement.pdf</a>
|
||||||
|
<a href="artificialintelligenceforbusiness2ndedition.pdf">artificialintelligenceforbusiness2ndedition.pdf</a>
|
||||||
|
<a href="autotools-2nd-edition-a-practitioners-guide-to-gnu-autoconf-automake-and-libtool-2nd-edition-9781593279721-1593279728.pdf">autotools-2nd-edition-a-practitioners-guide-to-gnu-autoconf-automake-and-libtool-2nd-edition-9781593279721-1593279728.pdf</a>
|
||||||
|
<a href="beginning-x64-assembly-programming-from-novice-to-avx-professional-9781484250754-9781484250761-1484250753-1484250761.pdf">beginning-x64-assembly-programming-from-novice-to-avx-professional-9781484250754-9781484250761-1484250753-1484250761.pdf</a>
|
||||||
|
<a href="beyondthealgorithm_aisecurityprivacyandethics.pdf">beyondthealgorithm_aisecurityprivacyandethics.pdf</a>
|
||||||
|
<a href="binsok.pdf">binsok.pdf</a>
|
||||||
|
<a href="buildingmoderncliapplicationsingo.pdf">buildingmoderncliapplicationsingo.pdf</a>
|
||||||
|
<a href="c10andnet6_moderncross-platformdevelopment.pdf">c10andnet6_moderncross-platformdevelopment.pdf</a>
|
||||||
|
<a href="c12andnet8_moderncross-platformdevelopmentfundamentals.pdf">c12andnet8_moderncross-platformdevelopmentfundamentals.pdf</a>
|
||||||
|
<a href="cdatastructuresandalgorithms_secondedition.pdf">cdatastructuresandalgorithms_secondedition.pdf</a>
|
||||||
|
<a href="cinterviewguide.pdf">cinterviewguide.pdf</a>
|
||||||
|
<a href="cleancodewithcsharp.pdf">cleancodewithcsharp.pdf</a>
|
||||||
|
<a href="cworkshop.pdf">cworkshop.pdf</a>
|
||||||
|
<a href="deeplearningillustrated.pdf">deeplearningillustrated.pdf</a>
|
||||||
|
<a href="domain-drivendesignwithgolang.pdf">domain-drivendesignwithgolang.pdf</a>
|
||||||
|
<a href="effectiveconcurrencyingo.pdf">effectiveconcurrencyingo.pdf</a>
|
||||||
|
<a href="enterpriseapplicationdevelopmentwithc10andnet6.pdf">enterpriseapplicationdevelopmentwithc10andnet6.pdf</a>
|
||||||
|
<a href="event-drivenarchitectureingolang.pdf">event-drivenarchitectureingolang.pdf</a>
|
||||||
|
<a href="foundationalpythonfordatascience.pdf">foundationalpythonfordatascience.pdf</a>
|
||||||
|
<a href="foundations-of-game-engine-development-volume-1-mathematics-1nbsped-0985811749-9780985811747_compress.pdf">foundations-of-game-engine-development-volume-1-mathematics-1nbsped-0985811749-9780985811747_compress.pdf</a>
|
||||||
|
<a href="foundations-of-game-engine-development-volume-2-rendering-2-4nbsped-9780985811754_compress.pdf">foundations-of-game-engine-development-volume-2-rendering-2-4nbsped-9780985811754_compress.pdf</a>
|
||||||
|
<a href="foundationsofdeepreinforcementlearning.pdf">foundationsofdeepreinforcementlearning.pdf</a>
|
||||||
|
<a href="functionalprogrammingingo.pdf">functionalprogrammingingo.pdf</a>
|
||||||
|
<a href="futex.pdf">futex.pdf</a>
|
||||||
|
<a href="goprogramming_frombeginnertoprofessional.pdf">goprogramming_frombeginnertoprofessional.pdf</a>
|
||||||
|
<a href="goprogrammingcookbook.pdf">goprogrammingcookbook.pdf</a>
|
||||||
|
<a href="grpcgoforprofessionals.pdf">grpcgoforprofessionals.pdf</a>
|
||||||
|
<a href="hands-onnetworkprogrammingwithcandnetcore.pdf">hands-onnetworkprogrammingwithcandnetcore.pdf</a>
|
||||||
|
<a href="hands-onobject-orientedprogrammingwithc.pdf">hands-onobject-orientedprogrammingwithc.pdf</a>
|
||||||
|
<a href="hands-onsoftwarearchitecturewithgolang.pdf">hands-onsoftwarearchitecturewithgolang.pdf</a>
|
||||||
|
<a href="hands-onsoftwareengineeringwithgolang.pdf">hands-onsoftwareengineeringwithgolang.pdf</a>
|
||||||
|
<a href="hands-onsystemprogrammingwithgo.pdf">hands-onsystemprogrammingwithgo.pdf</a>
|
||||||
|
<a href="high-performanceprogrammingincandnet.pdf">high-performanceprogrammingincandnet.pdf</a>
|
||||||
|
<a href="implementingevent-drivenmicroservicesarchitectureinnet7.pdf">implementingevent-drivenmicroservicesarchitectureinnet7.pdf</a>
|
||||||
|
<a href="introducingmachinelearning.pdf">introducingmachinelearning.pdf</a>
|
||||||
|
<a href="learndatastructuresandalgorithmswithgolang.pdf">learndatastructuresandalgorithmswithgolang.pdf</a>
|
||||||
|
<a href="learningdeeplearning.pdf">learningdeeplearning.pdf</a>
|
||||||
|
<a href="machinelearninginproduction.pdf">machinelearninginproduction.pdf</a>
|
||||||
|
<a href="machinelearningwithpythonforeveryone.pdf">machinelearningwithpythonforeveryone.pdf</a>
|
||||||
|
<a href="masteringgo.pdf">masteringgo.pdf</a>
|
||||||
|
<a href="meltdown.pdf">meltdown.pdf</a>
|
||||||
|
<a href="microservicescommunicationinnetusinggrpc.pdf">microservicescommunicationinnetusinggrpc.pdf</a>
|
||||||
|
<a href="microservicesdesignpatternsinnet.pdf">microservicesdesignpatternsinnet.pdf</a>
|
||||||
|
<a href="microserviceswithgo.pdf">microserviceswithgo.pdf</a>
|
||||||
|
<a href="mvvmpatterninnetmaui.pdf">mvvmpatterninnetmaui.pdf</a>
|
||||||
|
<a href="netmauicross-platformapplicationdevelopment.pdf">netmauicross-platformapplicationdevelopment.pdf</a>
|
||||||
|
<a href="netmauiforcdevelopers.pdf">netmauiforcdevelopers.pdf</a>
|
||||||
|
<a href="parallelprogrammingandconcurrencywithc10andnet6.pdf">parallelprogrammingandconcurrencywithc10andnet6.pdf</a>
|
||||||
|
<a href="pm.pdf">pm.pdf</a>
|
||||||
|
<a href="pragmaticai.pdf">pragmaticai.pdf</a>
|
||||||
|
<a href="pragmatictest-drivendevelopmentincandnet.pdf">pragmatictest-drivendevelopmentincandnet.pdf</a>
|
||||||
|
<a href="predictiveanalytics_dataminingmachinelearninganddatascienceforpractitioners.pdf">predictiveanalytics_dataminingmachinelearninganddatascienceforpractitioners.pdf</a>
|
||||||
|
<a href="programmingmlnet.pdf">programmingmlnet.pdf</a>
|
||||||
|
<a href="quickstartguidetolargelanguagemodels.pdf">quickstartguidetolargelanguagemodels.pdf</a>
|
||||||
|
<a href="real-worldimplementationofcdesignpatterns.pdf">real-worldimplementationofcdesignpatterns.pdf</a>
|
||||||
|
<a href="refactoringwithc.pdf">refactoringwithc.pdf</a>
|
||||||
|
<a href="responsibleai.pdf">responsibleai.pdf</a>
|
||||||
|
<a href="simd-software-rendering.pdf">simd-software-rendering.pdf</a>
|
||||||
|
<a href="simd.pdf">simd.pdf</a>
|
||||||
|
<a href="softwarearchitecturewithc10andnet6_thirdedition.pdf">softwarearchitecturewithc10andnet6_thirdedition.pdf</a>
|
||||||
|
<a href="spectre.pdf">spectre.pdf</a>
|
||||||
|
<a href="test-drivendevelopmentingo.pdf">test-drivendevelopmentingo.pdf</a>
|
||||||
|
<a href="vbNet_programming.pdf">vbNet_programming.pdf</a>
|
||||||
|
<a href="xlib.pdf">xlib.pdf</a>
|
||||||
|
</pre>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
it has some text in it
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
//easily put attrs in a tag
|
||||||
|
type htmlAttrs map[string]string
|
||||||
|
func (attrs htmlAttrs) String() string {
|
||||||
|
var ret string
|
||||||
|
for k, v := range attrs {
|
||||||
|
ret += fmt.Sprintf("%s=\"%s\" ", k, url.QueryEscape(v))
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
func wrapWithTagAttrs(str, tag string, a htmlAttrs) string {
|
||||||
|
return fmt.Sprintf("<%s %s>%s</%s>", tag, a.String(), str, tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func wrapWithTag(str string, tag string) string {
|
||||||
|
return fmt.Sprintf("<%s>%s</%s>", tag, str, tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
//cleaner than making an attr for one href
|
||||||
|
func wrapWithTagHref(str string, tag string) string {
|
||||||
|
taggedString := fmt.Sprintf("<%s href=%s>%s</%s>", tag, url.QueryEscape(str), str, tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func serveStylesheet(w http.ResponseWriter, r *http.Request) {
|
||||||
|
sheet, err := os.Open("style.css")
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "File not found", http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer sheet.Close()
|
||||||
|
|
||||||
|
w.Header().Set("Content-Disposition", "attachment; filename=style.css")
|
||||||
|
w.Header().Set("Content-Type", "text/css")
|
||||||
|
|
||||||
|
_, err = io.Copy(w, sheet)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Error sending file", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
port := flag.String("p", "6969", "port to serve on")
|
||||||
|
directory := flag.String("d", ".", "the directory of static file to host")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
var contents string
|
||||||
|
entries, err := os.ReadDir(*directory)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, e := range entries {
|
||||||
|
new := e.Name()
|
||||||
|
http.HandleFunc("/" + url.QueryEscape(new), func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Println("Request for resource: ", r.RequestURI)
|
||||||
|
|
||||||
|
//could also generate the css at runtime
|
||||||
|
if r.RequestURI == "/style.css" {
|
||||||
|
serveStylesheet(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
file, err := os.Open(*directory + "/" + new)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "File not found.", http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
w.Header().Set("Content-Disposition", "attachment; filename=" + new)
|
||||||
|
w.Header().Set("Content-Type", "application/octet-stream")
|
||||||
|
|
||||||
|
_, err = io.Copy(w, file)
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Error sending file.", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
gridAttrs := htmlAttrs {
|
||||||
|
"class": "grid-item",
|
||||||
|
}
|
||||||
|
|
||||||
|
hrefAttrs := htmlAttrs {
|
||||||
|
"href": e.Name(),
|
||||||
|
}
|
||||||
|
|
||||||
|
var href string
|
||||||
|
href = wrapWithTagAttrs(e.Name(), "a", hrefAttrs)
|
||||||
|
contents += wrapWithTagAttrs(href, "div", gridAttrs)
|
||||||
|
contents += "\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
gridContainerAttrs := htmlAttrs {
|
||||||
|
"class": "grid-container",
|
||||||
|
}
|
||||||
|
|
||||||
|
contents = wrapWithTagAttrs(contents, "div", gridContainerAttrs)
|
||||||
|
contents = wrapWithTag(contents, "pre")
|
||||||
|
contents = wrapWithTag("<link rel=\"stylesheet\" href=\"style.css\">", "head") + contents
|
||||||
|
contents = wrapWithTag(contents, "html")
|
||||||
|
contents = "<!DOCTYPE html>" + contents
|
||||||
|
|
||||||
|
handler := func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Write([]byte(contents))
|
||||||
|
}
|
||||||
|
|
||||||
|
http.Handle("/", http.HandlerFunc(handler))
|
||||||
|
log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
|
||||||
|
log.Fatal(http.ListenAndServe(":"+*port, nil))
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
require 'net/http'
|
||||||
|
|
||||||
|
url = URI.parse("")
|
||||||
|
req = Net::HTTP::Get.new(url.to_s)
|
||||||
|
res = Net::HTTP.start(url.host, url.port) { |http|
|
||||||
|
http.request(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
puts res.body
|
||||||
Loading…
Reference in New Issue