There’s a chess board of size
Knight can step by going forward or backward two units in one direction, and one units in the other direction.
Find a way to position
| (add-to-list 'load-path "~/.emacs.d/el-get/el-get") | |
| (unless (require 'el-get nil 'noerror) | |
| (with-current-buffer | |
| (url-retrieve-synchronously | |
| "https://raw.github.com/dimitri/el-get/master/el-get-install.el") | |
| (let (el-get-master-branch | |
| el-get-install-skip-emacswiki-recipes) | |
| (goto-char (point-max)) | |
| (eval-print-last-sexp)))) |
| #!/usr/bin/env ruby | |
| require 'optparse' | |
| require 'pry' | |
| def main | |
| options = {to_encoding: 'utf-8'} | |
| option_parser = OptionParser.new do |opts| | |
| executable_name = File.basename($PROGRAM_NAME) |
| # This file provide two pandoc filters for html and pdf output | |
| module Nanoc::Filters | |
| class PandocHtml < Nanoc::Filter | |
| identifier :pandoc_html | |
| type :text => :text | |
| def run(content, params = {}) | |
| input_format = case item[:extension] |
| require 'json' | |
| require 'yaml' | |
| input_filename = ARGV[0] | |
| output_filename = input_filename.sub(/(yml|yaml)$/, 'json') | |
| input_file = File.open(input_filename, 'r') | |
| input_yml = input_file.read | |
| input_file.close |
| #!/bin/bash | |
| # run it with sudo | |
| # https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04 | |
| SWAPFILE=/swapfile | |
| SWAPSIZE=$1 | |
| ls $SWAPFILE && swapoff $SWAPFILE && rm $SWAPFILE | |
| fallocate -l $SWAPSIZE $SWAPFILE | |
| chmod 600 $SWAPFILE |
| @font-face { | |
| font-family: 'Linux Libertine'; /* normal */ | |
| src: url('/static/fonts/linux-libertine/LinLibertine_R.woff') format('woff'); | |
| font-weight: normal; | |
| font-style: normal; | |
| } | |
| @font-face { | |
| font-family: 'Linux Libertine'; /* italic */ | |
| src: url('/static/fonts/linux-libertine/LinLibertine_RI.woff') format('woff'); |
| defmodule Chop do | |
| def guess(final, range) do | |
| low..high = range | |
| middle = div(low + high, 2) | |
| _guess_helper(final, low, high, middle) | |
| end | |
| defp _guess_helper(final, _low, _high, middle) when final === middle do | |
| middle | |
| end |
import matplotlib.pyplot as plt
import numpy as np
L = 6
x = np.linspace(0, L)
ncolors = len(plt.rcParams['axes.color_cycle'])
shift = np.linspace(0, L, ncolors, endpoint=False)
for s in shift:
plt.plot(x, np.sin(x + s), 'o-')
| import Data.List | |
| perm :: (Eq a) => [a] -> Int -> [[a]] | |
| perm _ 0 = [[]] | |
| perm xs r | length xs < r = [[]] | |
| | otherwise = [x:ys | x <- xs, ys <- perm (delete x xs) (r - 1)] |