Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
- Best practices
| # Setup: | |
| # conda create -n whisper python=3.9 | |
| # conda activate whisper | |
| # https://github.com/openai/whisper | |
| # pip install git+https://github.com/openai/whisper.git | |
| # Usage: | |
| # python whisper-audio-to-text.py --audio_dir my_files --out_dir texts | |
| import argparse |
Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
| rustup check # Check for updates to Rust toolchains and rustup | |
| rustup component list # List installed and available components of the current Rust toolchain | |
| rustup install stable | |
| rustup default beta | |
| rustup update # updating to the latest version | |
| rustup toolchain list # list installed toolchains | |
| rustup toolchain install stable-gnu # to install the GNU ABI (application binary interface) | |
| cargo new [OPTIONS] <path> | |
| # create a new Cargo package in the given directory; |
| package akkahttptest | |
| import akka.actor.ActorSystem | |
| import akka.http.Http | |
| import akka.stream.FlowMaterializer | |
| import akka.http.server._ | |
| import akka.http.marshalling.PredefinedToResponseMarshallers._ | |
| import akka.stream.scaladsl.{HeadSink, Source} | |
| object Proxy extends App { |
| package akkahttptest | |
| import akka.actor.ActorSystem | |
| import akka.http.Http | |
| import akka.stream.FlowMaterializer | |
| import akka.http.server._ | |
| import akka.http.marshalling.PredefinedToResponseMarshallers._ | |
| import akka.stream.scaladsl.{HeadSink, Source} | |
| object Proxy extends App { |
| package mapmap | |
| trait ECtx | |
| trait KCtx | |
| trait Var[C, T] { | |
| def get(c: C): T | |
| } |
| package controllers | |
| import config.{EndpointConfig => Config} | |
| import play.api.mvc._ | |
| import play.api.Play.current | |
| import play.api.libs.ws.{WSRequest, WS} | |
| import scala.concurrent.Future | |
| import scala.concurrent.ExecutionContext.Implicits.global |
| using System.Net; | |
| using Microsoft.Bot.Connector; | |
| public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log) | |
| { | |
| log.Verbose($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}"); | |
| var msg = await req.Content.ReadAsAsync<Message>(); |
| #!/bin/bash | |
| # Inspired by http://www.devthought.com/code/create-a-github-pull-request-from-the-terminal/ | |
| targetbranch=master | |
| if test "$1"; then | |
| targetbranch=$1 | |
| fi | |
| repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"` |
| #!/bin/bash | |
| # customizable | |
| LIST_DATA="#{window_name} #{pane_title} #{pane_current_path} #{pane_current_command}" | |
| FZF_COMMAND="fzf-tmux -p --delimiter=: --with-nth 4 --color=hl:2" | |
| # do not change | |
| TARGET_SPEC="#{session_name}:#{window_id}:#{pane_id}:" | |
| # select pane |