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
| #!/bin/zsh | |
| usage () cat <<EOS | |
| usage: ${ZSH_SCRIPT:t:s/-/ /} [-c | -m | -p | -bBRANCH] [file] [start[-end]] | |
| options: | |
| -c use the current branch | |
| -m use the master branch [default] | |
| -p get a permalink | |
| -bBRANCH use BRANCH |
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
| ## SH | |
| while test $count -gt 0; do | |
| echo $string\\c | |
| count=`expr $count - 1` | |
| done | |
| ## CSH | |
| while ( $count > 0 ) | |
| echo -n $string | |
| @ count-- |
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
| ################################################################################ | |
| # Option 1: Just repeat the defaults | |
| ################################################################################ | |
| alias ls="ls -ACFPq" | |
| ## ... other config ... | |
| # macOS config | |
| if [ "$(uname)" = Darwin ]; then |
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
| #!/bin/sh | |
| # Safety first | |
| set -o nounset | |
| scriptname="$(basename -- "$0"; echo x)"; scriptname="${scriptname%?x}" | |
| warn () { | |
| msg="%s: $1"'\n' | |
| shift |
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
| [12:27:12 PM 1029] ruby % git diff | |
| diff --git a/gc.c b/gc.c | |
| index 3fd2a3b33f..f909e5b81b 100644 | |
| --- a/gc.c | |
| +++ b/gc.c | |
| @@ -11460,6 +11460,10 @@ gc_stress_get(rb_execution_context_t *ec, VALUE self) | |
| static void | |
| gc_stress_set(rb_objspace_t *objspace, VALUE flag) | |
| { | |
| + if (flag != Qtrue && flag != Qfalse) { |
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
| CWD =: (<./CWD i:'/\') {.CWD=: ;(4!:3''){~4!:4 CWD=: <'CWD' | |
| raw =: }: freads CWD , '/day2.txt' | |
| die =: {{ echo y throw. }} | |
| NB. raw =: '1,9,10,3,2,3,11,0,99,30,40,50' | |
| ints =: ". every (',' cut raw) | |
| ints =: (12 2) (1 2) } ints | |
| number_of_params =: ((_ 3 3) , (_ * i.96) , 0) & { |
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
| raw =: '1,9,10,3,2,3,11,0,99,30,40,50' | |
| ints =: ". every (',' cut raw) | |
| run_one =: {{ | |
| 'op src1 src2 dst' =. (x + i.4) { y | |
| select. op | |
| case. 1 do. ((src1{y)+(src2{y)) dst } y | |
| case. 2 do. y((src1{y)*(src2{y)) dst } y |
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
| #!/usr/bin/env ruby | |
| # Knight in ruby, but with copious amounts of monkey patching :-) | |
| class Fn | |
| @fns = {} | |
| def self.register(name, ...) = @fns[name] = Fn.new(...) | |
| def self.lookup(name) = @fns.fetch(name) | |
| def initialize(call_args: true, &block) @call_args, @block = call_args, block end |
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
| class ParseError < RuntimeError; end | |
| class Token | |
| attr_reader :value, :kind, :location | |
| def initialize(value, kind, location) | |
| @value = value | |
| @kind = kind | |
| @location = location | |
| end |
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
| class Literal { | |
| constructor(value) { this.value = value; } | |
| run(env) { return this; } | |
| toInteger() { return parseInt(this.value); } | |
| toString() { return "" + this.value; } | |
| toBoolean() { return !!this.value; } | |
| } | |
| class Variable { | |
| constructor(name) { this.name = name; } |
NewerOlder