Skip to content

Instantly share code, notes, and snippets.

@Arty2
Arty2 / fixedsearch.js
Last active June 23, 2024 15:45 — forked from cmod/hugofastsearch.md
Super fast, client side search for Hugo.io with Fusejs.io
// static/scripts/fixedsearch/fixedsearch.js
/*--------------------------------------------------------------
fixedsearch — Super fast, client side search for Hugo.io with Fusejs.io
based on https://gist.github.com/cmod/5410eae147e4318164258742dd053993
--------------------------------------------------------------*/
if (typeof variable !== 'undefined') {
console.log('fixedsearch.js already loaded');
} else {
fixedsearch = function(){
#!/bin/bash
# Wrapper script for git mergetool
# This requires the .gitconfig file to have:
# - mergetool entry for "wdiff";
# - mergetool entry for "fw_def";
# These merge tool entries must both specify the
# cmd field. The command to call this script:
# [mergetool "merge_wrapper"]
# cmd = $HOME/merge-wrapper \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
# Locate this script in your $HOME
@vsajip
vsajip / ansistrm.py
Created December 29, 2010 11:14
Python logging: colourising terminal output
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
#
import ctypes
import logging
import os
class ColorizingStreamHandler(logging.StreamHandler):
# color names to indices
color_map = {
from __future__ import with_statement
import random
def create_chain(file_paths):
markov_chain = {}
word1 = "\n"
word2 = "\n"
for path in file_paths:
with open(path) as file:
for line in file: