This file contains hidden or 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
| function cd-gitroot(){ | |
| cd $(git rev-parse --show-toplevel) | |
| } |
This file contains hidden or 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
| $profile.psobject.properties | where { $_ -is [psnoteproperty] } | foreach { echo $_.value; Measure-Command { . $_ | |
| .value }} |
This file contains hidden or 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
| function ln-s() { | |
| cmd /c mklink $args[0] $args[1] | |
| } |
This file contains hidden or 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
| # jupyter execution | |
| function je(){ | |
| if [ $# = 2 ] | |
| then | |
| kernel=$2 | |
| elif [ $# = 1 ] && [ -n $CONDA_DEFAULT_ENV ] | |
| then | |
| kernel=$CONDA_DEFAULT_ENV | |
| fi | |
| echo $1 $kernel |
This file contains hidden or 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
| # https://stackoverflow.com/a/44411205/10051099 | |
| function Write-BranchName () { | |
| try { | |
| $branch = git rev-parse --abbrev-ref HEAD | |
| if ($branch -eq "HEAD") { | |
| # we're probably in detached HEAD state, so print the SHA | |
| $branch = git rev-parse --short HEAD | |
| Write-Host " ($branch)" -ForegroundColor "red" | |
| } |
This file contains hidden or 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 is_iso(g, h): | |
| return (Counter(frozenset(g.degree[ee] for ee in e) for e in g.edges) == | |
| Counter(frozenset(h.degree[ee] for ee in e) for e in h.edges)) |
This file contains hidden or 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 permutations | |
| func Permutations(arr []int) <-chan []int { | |
| var fn func([]int, int) | |
| ch := make(chan []int) | |
| token := make(chan struct{}, factorial(len(arr))) | |
| fn = func(arr []int, n int) { | |
| if n == 1 { | |
| tmp := make([]int, len(arr)) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| [metadata] | |
| name = {} | |
| home-page = {} | |
| long-description = file: README.md | |
| [options] | |
| zip_safe = false | |
| include_package_data = true | |
| python_requires = >=3.6 | |
| packages = {} |
This file contains hidden or 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 qualified Data.Vector.Unboxed as U | |
| import Data.Vector.Unboxed ( (!) ) | |
| import qualified Data.Vector.Unboxed.Mutable as UM | |
| import Control.Monad.ST | |
| import Control.Monad | |
| base = 10 ^ 9 + 7 :: Int | |
| maxL = 3 * 10 ^ 5 :: Int | |
| n *% m = (n * m) `mod` base |