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
| /* from https://www.lemoda.net/c/simple-tap-test/ */ | |
| static int tap_count; | |
| static int tap_todo; | |
| static int tap_fail; | |
| #define ENDLINE { \ | |
| if (tap_todo) { \ | |
| printf (" # TODO\n"); \ | |
| } \ |
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
| const basket = [ | |
| { name:"apple", type: "fruit", calories: 52 }, | |
| { name:"broccoli", type: "vegetable", calories: 45 }, | |
| { name:"banana", type: "fruit", calories: 89 } | |
| ]; | |
| class CaloriesAccumulator { | |
| constructor(fruitCount = 0, avgCalories = 0) { | |
| console.debug(`count: ${fruitCount}\tavg: ${avgCalories}`) | |
| this.fruitCount = fruitCount |
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
| version: "3.5" | |
| services: | |
| with-adp-messaging: | |
| image: cmd.cat/grep | |
| command: sh -c "mount|egrep --color=always 'adp-messaging|^'" | |
| volumes: | |
| # THIS IS THE IMPORTANT LINE - defaults to /var/log/adp-messaging when env is undefined | |
| - ${ADP_MESSAGING_LOG_DIR:-/var/log/adp-messaging}:/var/log/adp-messaging |
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
| # I actually just pasted this inline as part of a TC buildstep but hey, wanna get the Gist to color coding correctly | |
| encodeURI() { | |
| # for each char from stdin | |
| old_lc_collate=$LC_COLLATE | |
| LC_COLLATE=C | |
| for c in $(grep -o .) | |
| do | |
| case $c in | |
| [a-zA-Z0-9.~_-/?=&]) printf "$c" ;; | |
| *) printf '%%%02X' "'$c" ;; |
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
| --- | |
| # in retrospect, it's better to just run e.g. | |
| # ansible all -a true --ssh-extra-args="-o UpdateHostKeys=yes -o StrictHostKeyChecking=accept-new" | |
| - hosts: all | |
| gather_facts: false | |
| tasks: | |
| - name: Set custom SSH port fact (or use default) | |
| delegate_to: localhost | |
| set_fact: |
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
| node -e 'd=new Date("2000-01-01");console.error(`Start JS: ${d}`);console.log(d)' \ | |
| | xargs scala -nc -e 'val d=java.time.OffsetDateTime.parse(args.head);System.err.println(s"In Scala: $d");println(d)' \ | |
| | xargs node -e 'd=new Date(process.argv.pop());console.error(`End JS: ${d} ;-)`);console.log(d)' |
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
| require 'formula' | |
| class Scalafmt < Formula | |
| head 'https://github.com/scalameta/scalafmt.git' | |
| def install | |
| bin.install 'scalafmt' | |
| end | |
| 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
| # sudo will probably prompt = you won't be able to just cut-n-paste into a terminal | |
| # ... but I didn't have to spell that out for ya', right? ;-) | |
| sudo ( find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; | |
| sudo find /private/var/folders -name com.apple.iconservices -exec rm -rf {} \; | |
| killall Dock |
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
| defaults export com.apple.LaunchServices/com.apple.launchservices.secure - | sed -e s/apple.mail/microsoft.outlook/ | defaults import com.apple.LaunchServices/com.apple.launchservices.secure - | |
| /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -all local,system,user |
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
| # Step 0 -- create test data | |
| redis-cli HSET :object:30343552:data foo bar | |
| # Step 1 -- store sample function 'sampleFunction' | |
| redis-cli SET :functions:sample1 " | |
| redis.call('SELECT', 0); | |
| local data = redis.call('HGETALL', ':object:' .. ARGV[1] .. ':data'); | |
| return table.concat(data, '+'); | |
| " |