Skip to content

Instantly share code, notes, and snippets.

@jinwei233
jinwei233 / watch.rb
Created February 13, 2018 08:59 — forked from JamieMason/watch.rb
mac上监控文件变化,并刷新页面 Watch a folder for changes to files, then reload Chrome
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]
@jinwei233
jinwei233 / latex2png.sh
Created November 15, 2017 07:33 — forked from wx13/latex2png.sh
bash script to convert a latex equation into a png image
#!/bin/bash
alias latex='/usr/bin/latex'
alias dvipng='/usr/bin/dvipng'
alias convert='/usr/bin/convert'
#choose a number from 75-300
density=300
if [ $# != 2 ]
then
echo "Usage: $0 output_file latex_code"
@jinwei233
jinwei233 / latex_server.rb
Created November 15, 2017 07:32 — forked from farleyknight/latex_server.rb
Latex server. Pass equations, get pngs
# Usage:
# ruby latex_server.rb
#
# Try: <img src="http://localhost:4567/\cos \frac{\pi}{2} = 0">
# Get: A nice looking png of: cos(pi/2) = 0
#
# Bug1: Ellipses (...) don't work. Probably the way urls are parsed
# b