This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compositions(t=2,s=2): | |
"""knuth 7.2.1.3""" | |
q = [0] * (t+1) | |
r = None | |
q[0] = s | |
while True: | |
yield q[:] | |
if q[0] == 0: | |
if r==t: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Copyright 2018 Google LLC | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
https://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Copyright 2017 Google LLC | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
https://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_foregroundcolor(ax, color): | |
'''For the specified axes, sets the color of the frame, major ticks, | |
tick labels, axis labels, title and legend | |
''' | |
for tl in ax.get_xticklines() + ax.get_yticklines(): | |
tl.set_color(color) | |
for spine in ax.spines: | |
ax.spines[spine].set_edgecolor(color) | |
for tick in ax.xaxis.get_major_ticks(): | |
tick.label1.set_color(color) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s "http://httpbin.org/get?a=echo%20'you%20moron'" | jq '.args.a' | tr -d '"' | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
from mercurial import commands | |
from mercurial import ui | |
from mercurial import localrepo | |
def sha_string(hash): | |
import base64 | |
return base64.b16encode(hash).lower() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mercurial import commands, ui, localrepo | |
import sys | |
# default git branch name | |
cfg_master='master' | |
origin_name='' | |
def get_branch(name): | |
# 'HEAD' is the result of a bug in mutt's cvs->hg conversion, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"log" | |
"fmt" | |
"path/filepath" | |
"strconv" | |
"strings" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn buildMap [fl] | |
(cond | |
(.isDirectory fl) | |
(let [subfiles (filter (complement nil?) (map buildMap (.listFiles fl)))] | |
(list (.getAbsolutePath fl) subfiles (reduce + (map last subfiles))) | |
) | |
(.isFile fl) | |
(list (.getAbsolutePath fl) (.length fl)) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
NewerOlder