Skip to content

Instantly share code, notes, and snippets.

yous / marked-google-drive.user.js
Last active Nov 18, 2021
Marked on Google Drive
View marked-google-drive.user.js
// ==UserScript==
// @name Marked on Google Drive
// @namespace
// @version 1.0.0
// @description Render markdown preview on Google Drive
// @author yous
// @homepageURL
// @updateURL
// @license MIT
// @match*
yous / replace-fonts-macos.user.css
Last active Sep 16, 2021
Replace old fonts with new ones
View replace-fonts-macos.user.css
/* ==UserStyle==
@name Replace fonts in macOS
@version 1.0.0
@description Replace old fonts with better ones
@author yous
@license CC-BY-4.0
==/UserStyle== */
yous / safari-fonts.css
Created Nov 22, 2018
Custom CSS for Korean fonts on Safari
View safari-fonts.css
@font-face {
font-style: normal;
font-family: "Batang";
src: local("AppleMyungjo");
@font-face {
font-style: normal;
font-family: "바탕";
src: local("AppleMyungjo");
yous /
Created Oct 2, 2018
256 colors for Open Color according to CIEDE2000
from colormath.color_objects import sRGBColor, LabColor
from colormath.color_conversions import convert_color
from colormath.color_diff import delta_e_cie2000
def hex_to_rgb(h):
return sRGBColor(h / 0x10000, (h / 0x100) % 0x100, h % 0x100,
yous / server
Last active Dec 15, 2017 — forked from chrismdp/http
Simple http server in ruby, that ensures there's no browser caching. For serving static files in development.
View server
#!/usr/bin/env ruby
require 'webrick'
require 'optparse'
class NonCachingFileHandler < WEBrick::HTTPServlet::FileHandler
def prevent_caching(res)
res['ETag'] = nil
res['Last-Modified'] = + 100**4
res['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
res['Pragma'] = 'no-cache'
yous / server.rb
Created Dec 5, 2016
Thin + Rack file server with basic auth on Windows
View server.rb
require 'rack'
require 'thin'
dirname = File.expand_path(File.dirname(__FILE__))
fileroot = File.join(dirname, 'files')
module Rack
class UTF8Directory < Directory
class DirectoryBody < Directory::DirectoryBody
yous /
Created Dec 5, 2016
Multithreaded SimpleHTTPServer with basic auth
import os
import base64
import SocketServer
import BaseHTTPServer
import SimpleHTTPServer
class AuthHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_AUTHHEAD(self):
yous /
Created Dec 5, 2016
Simple multithreaded Flask file server with basic auth
import os.path
from functools import wraps
from flask import Flask, request, Response, redirect
from flask_autoindex import AutoIndex
fileroot = os.path.join(os.path.realpath(os.path.curdir), 'files')
app = Flask(__name__)
idx = AutoIndex(app,
yous /
Created Jan 5, 2016
Print 256 colors
#!/usr/bin/env bash
for i in {0..7}; do
next=$((${i} + 8))
printf "\x1b[38;5;${i}mcolour${i} \x1b[38;5;${next}mcolour${next}\n"
for i in {16..255}; do
printf "\x1b[38;5;${i}mcolour${i} "
if [[ $((${i} % 6)) == 3 ]]; then
printf "\n"
yous / new_year.rb
Last active Dec 31, 2015
Happy New Year
View new_year.rb
class Happy
def initialize
print "#{self.class} New "
@year =
def method_missing(meth)
puts "#{__method__.to_s[/\w+/].capitalize} #{@year}#{meth.to_s[/\W+/]}"