This file contains 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
module main | |
import cli, os | |
fn main( | |
mut app := cli.Command{ | |
name: 'pizzahut' | |
description: 'Cli for ordering pizza from Pizza Hut' | |
// execute: // Without specifying the `execute` parameter, it will just output the usage message | |
commands: [ |
This file contains 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
// Put it in your bin folder, build the site, and run `dart run bin/server.dart` | |
// Go to http://localhost:8080 to see the result! o(^▽^)o | |
// | |
// Remember to open in an incognito or guest window, or the browser might use | |
// the cache instead of letting the server render it (yes FireFox that's you). | |
import 'dart:io'; | |
// Remember to add these dependencies! | |
import 'package:mime/mime.dart'; |
This file contains 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 | |
mkdir -p $HOME/SDK/ | |
curl -o node.tar.gz -L https://nodejs.org/dist/v16.7.0/node-v16.7.0-darwin-arm64.tar.gz | |
tar -xf node.tar.gz -C $HOME/SDK && rm -rf node.tar.gz | |
mv node-v16.7.0-darwin-arm64 node | |
echo "export PATH=$PATH:$HOME/SDK/node/bin" >> $HOME/.zshrc | |
source $HOME/.zshrc | |
node --version |
This file contains 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 'dart:io'; | |
import 'dart:convert'; | |
import 'package:path/path.dart' as p; | |
main(List<String> args) async { | |
print('Counting number of Dart files...'); | |
var count = 0; | |
await Directory('lib').list(recursive: true).forEach((element) { | |
if (element is File && p.extension(element.path) == '.dart') { |
This file contains 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 'dart:ffi' as ffi; | |
typedef getchar_func = ffi.Int8 Function(); | |
final dylib = ffi.DynamicLibrary.open("/usr/lib/libstdc++.so"); | |
final int Function() getChar = | |
dylib.lookup<ffi.NativeFunction<getchar_func>>('getchar').asFunction(); | |
void main() { | |
int input = getChar(); | |
// There's no `char` in Dart. Use the following to convert your ASCII value |
This file contains 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 'dart:ffi'; | |
import 'package:ffi/ffi.dart'; | |
void main(List<String> arguments) { | |
print('Opening the executable...'); | |
final lib = DynamicLibrary.executable(); | |
print('Grabbing `free` function from myself...'); | |
final free = lib.lookupFunction<Void Function(Pointer), void Function(Pointer)>('free'); | |
const String test = "Hello World!"; |
This file contains 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 std.stdio, std.array, std.container, std.string, std.file, std.conv, std.algorithm, std.parallelism, std.path; | |
import moss.deps.dependency; | |
import moss.format.binary.reader; | |
import moss.format.binary.payload; | |
import moss.format.binary.payload.meta; | |
import moss.format.binary.payload.meta.record_pair; | |
import moss.format.binary.payload.layout; | |
void mkuniq(T)(ref T[] arr) | |
{ |
This file contains 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
# Nix下的OI环境,主要是为了Haskell | |
let | |
# 万一以后需要呢 | |
config = { allowUnfree = true; }; | |
pkgs = import <nixpkgs> { inherit config; }; | |
in { | |
# Base |
This file contains 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
module main; | |
import std.range; | |
import std.array; | |
import std.algorithm; | |
import std.string; | |
import std.stdio; | |
import std.format; | |
import std.conv; | |
import std.path; |
This file contains 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 main | |
import ( | |
"bufio" | |
"bytes" | |
"fmt" | |
"os" | |
"strconv" | |
"gopkg.in/yaml.v3" |
OlderNewer