Skip to content

Instantly share code, notes, and snippets.

@ryanli1994
ryanli1994 / upload_to_gist.sh
Last active October 26, 2022 20:46
upload file to gist bash
# 0. Your file name
FNAME=worker.log
GITHUB_USERNAME=kigawas
# 1. Somehow sanitize the file content
# Remove \r (from Windows end-of-lines),
# Replace tabs by \t
# Replace " by \"
# Replace EOL by \n
CONTENT=$(sed -e 's/\r//' -e's/\t/\\t/g' -e 's/"/\\"/g' "${FNAME}" | awk '{ printf($0 "\\n") }')
@ryanli1994
ryanli1994 / webtail.py
Last active August 30, 2016 01:36 — forked from scoffey/webtail.py
HTTP server that provides a web interface to run "tail" on a file, like the Unix command
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import BaseHTTPServer
import SocketServer
import collections
import logging
import os
import sys
import urlparse
import socket