Skip to content

Instantly share code, notes, and snippets.

@t1m0thyj
Created January 17, 2024 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t1m0thyj/083a478fcbaf544c1bb38ef9085cf3f9 to your computer and use it in GitHub Desktop.
Save t1m0thyj/083a478fcbaf544c1bb38ef9085cf3f9 to your computer and use it in GitHub Desktop.
CGit and Lighttpd config for GitHub mirror
server.modules += ( "mod_cgi", "mod_alias" )
$HTTP["url"] =~ "^/cgit" {
server.document-root = "/usr/lib/"
server.indexfiles = ("cgit.cgi")
cgi.assign = ("cgit.cgi" => "")
mimetype.assign = ( ".css" => "text/css" )
url.access-deny = ( "~", ".inc" )
}
alias.url += (
"/git" => "/usr/lib/cgit/cgit.cgi",
"/cgit-css" => "/usr/share/cgit",
)
$HTTP["url"] =~ "^/git" {
cgi.assign = ( "" => "" )
}
#
# cgit config
# see cgitrc(5) for details
css=/cgit-css/cgit.css
logo=/cgit-css/cgit.png
favicon=/cgit-css/favicon.ico
enable-http-clone=1
source-filter=/usr/lib/cgit/filters/syntax-highlighting2.py
about-filter=/usr/lib/cgit/filters/about-formatting.sh
readme=:README.md
scan-path=/mnt/readyshare/Backup/github
case-sensitive-sort=0
max-repo-count=100
--- syntax-highlighting.py 2020-03-29 23:24:26.000000000 -0400
+++ syntax-highlighting2.py 2024-01-16 00:23:32.586663579 -0500
@@ -22,11 +22,13 @@
import sys
import io
+import os
+os.environ["XDG_DATA_HOME"] = "/tmp"
from pygments import highlight
from pygments.util import ClassNotFound
from pygments.lexers import TextLexer
from pygments.lexers import guess_lexer
-from pygments.lexers import guess_lexer_for_filename
+from pygments_cache import guess_lexer_for_filename
from pygments.formatters import HtmlFormatter
@@ -34,7 +36,7 @@
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
data = sys.stdin.read()
filename = sys.argv[1]
-formatter = HtmlFormatter(style='pastie', nobackground=True)
+formatter = HtmlFormatter(style='tango', nobackground=True)
try:
lexer = guess_lexer_for_filename(filename, data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment