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
| ARG CONTAINER_BASE="fedora:39" | |
| # Build stage | |
| FROM $CONTAINER_BASE AS builder | |
| RUN dnf -y update | |
| RUN dnf install -y \ | |
| gcc \ | |
| make \ | |
| numactl-devel \ |
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 --platform=amd64 python:3 | |
| WORKDIR /usr/src/app | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # un-comment below if needs to run some script | |
| # COPY my_script.py . | |
| # CMD [ "python", "./my_script.py" ] |
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] | |
| name = "fastly-template-rust-default" | |
| version = "0.1.0" | |
| authors = [] | |
| edition = "2018" | |
| [profile.release] | |
| debug = true | |
| [dependencies] |
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
| // Macro expaned from | |
| // let (first, second) = tokio::join!(do_stuff1(), do_stuff2()); | |
| let (first, second) = { | |
| use ::tokio::macros::support::{maybe_done, poll_fn, Future, Pin}; | |
| use ::tokio::macros::support::Poll::{Ready, Pending}; | |
| let mut futures = (maybe_done(do_stuff1()), maybe_done(do_stuff2())); | |
| poll_fn(move |cx| { | |
| let mut is_pending = false; | |
| let (fut, ..) = &mut futures; |
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
| #[tokio::main] | |
| async fn main() -> Result<(), Box<dyn std::error::Error>> { | |
| let client = reqwest::Client::new(); | |
| let res = client.post("http://httpbin.org/post") | |
| .body("the exact body that is sent") | |
| .header("abc", "def") | |
| .send() | |
| .await?; |
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 T4StationService : Service() { | |
| var mLocSer: LocationService? = null | |
| var mHandler: MyHandler? = null | |
| inner class MyHandler(looper: Looper) : Handler(looper) { | |
| override fun handleMessage(msg: Message?) { | |
| super.handleMessage(msg) | |
| // call some function that needs to be called in UI thread |
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 MainFragment : Fragment() { | |
| //... | |
| override fun onCreateView( | |
| inflater: LayoutInflater, container: ViewGroup?, | |
| savedInstanceState: Bundle? | |
| ): View { | |
| val view: View = inflater.inflate(R.layout.main_fragment, container, false) | |
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 Gu1Fragment : Fragment() { | |
| // ... | |
| // dynamically add a button to the fragment | |
| // beware it is in onViewCreated, should NOT be in onCreateView | |
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| val btn :Button = Button(requireContext()) |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.constraint.ConstraintLayout | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:id="@+id/start" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| tools:context=".ui.start.StartFragment"> |
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 os | |
| import sys | |
| import Model_pb2 | |
| if len(sys.argv) != 2: | |
| print("usage: python3 show_mlmodel.py your_model.mlmodel") | |
| sys.exit(1) | |
| with open(sys.argv[1], "rb") as f: |
NewerOlder