大いに参考にさせていただいた記事: ラズパイに向けてRustをクロスコンパイル!
以下はUbuntu 20.04 LTS on WSL2で確認済み
-
Rustをインストール
-
arm用のgcc一式を入れる
大いに参考にさせていただいた記事: ラズパイに向けてRustをクロスコンパイル!
以下はUbuntu 20.04 LTS on WSL2で確認済み
Rustをインストール
arm用のgcc一式を入れる
| fn a(_:u64,_:u64){print!("{}",0x50f0000003bb8u64)}fn b(_:u64,_:u64){}fn h<'a,'b,T>(_:&'a&'b(),v:&'b mut[T])->&'a mut[T]{v}#[inline(never)]fn g<'a,T:Copy>(x:T)->&'a mut[T]{let f:fn(_,_)->_=h;print!("{:p}",&x);f(&&(),&mut[x;0x100])}pub fn main(){let x=g(0u64);let y=g(if x.as_ptr()as u64>>1>0{a}else{b});x[4]+=0x18f8;y[4]("/bin/sh\0".as_ptr()as _,0)} |
https://github.com/Rust-SDL2/rust-sdl2 を使う
macならbrewで入る
brew install sdl2 sdl2_gfx sdl2_image sdl2_ttf
| # A compilation of Jupyter kernels for DataScience | |
| # Copyright (c) Light Bytes Technology Ltd. | |
| # Distributed under the terms of the Modified BSD License. | |
| ARG BASE_CONTAINER=jupyter/tensorflow-notebook | |
| FROM $BASE_CONTAINER | |
| LABEL maintainer="Liam Deacon <liam.deacon@lightbytestechnology.co.uk>" | |
| # Install |
| #Modifed SimpleHTTPServer which returns cookies passed on the request | |
| import SimpleHTTPServer | |
| import logging | |
| cookieHeader = None | |
| class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
| def do_GET(self): | |
| self.cookieHeader = self.headers.get('Cookie') |
| fn main() { | |
| let x = 5; | |
| //if(x == 5) { //←こうも書けるが、コンパイル時に警告が出る | |
| if x == 5 { | |
| println!("x is 5"); | |
| } else { | |
| println!("x isn't 5"); | |
| } | |
| //ifは式だからこんなこともできる。(三項演算子はない) |
| import fruitbase, future, sequtils, algorithm | |
| # (copied from http://goran.krampe.se/2014/12/03/nim-seq/) | |
| # Collections are very important in Smalltalk, and they offer a huge protocol | |
| # for working with them. The workhorse in Smalltalk is OrderedCollection - which | |
| # together with Dictionary probably covers 90% of all collection use. | |
| # In Nim the equivalent of an OrderedCollection is the type `seq`. | |
| # | |
| # This is a little rundown of what you can do with seq using stdlib. |
| import math | |
| # copied from http://goran.krampe.se/2014/12/03/nim-seq/ | |
| # Dollars and Kgs | |
| type | |
| Dollar* = distinct float | |
| Kg* = distinct float | |
| proc `$`*(x: Dollar) :string = |
| import os | |
| let argc = paramCount() | |
| # プログラム名以外(C言語等におけるargv[1]以降) | |
| let argv = commandLineParams() | |
| # プログラム名のフルパス(C言語等におけるargv[0]) | |
| let programName = getAppFilename() |