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
| defmodule RustCompile do | |
| @rust_path "D:/var/Rust/hello" | |
| @rust_target "D:/var/Rust/hello/bin" | |
| def get_files(path_name) do | |
| with {:ok, files} <- File.ls(path_name) do | |
| files | |
| else | |
| {:error, reason} -> | |
| reason |
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
| use std::env; | |
| use std::path::Path; | |
| use std::fs; | |
| fn main() { | |
| let args: Vec<String> = env::args().collect(); | |
| if args.len() < 2 { | |
| println!("Invalid argumen!.\nCoba jalankan seperti ini: rename_book /tmp"); | |
| std::process::exit(1); | |
| } |
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
| % hello world program | |
| main(_Args) -> | |
| L = [1,2,3,4,5], | |
| % Function = fun(Elem) -> io:fwrite(Elem) end, | |
| lists:foreach(fun(Elem) -> io:fwrite("~p~n", [Elem]) end, L). |
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
| % hello world program | |
| % jalankan dengan escript.exe di windows | |
| % atau tambah #!/usr/bin/escript di linux | |
| main(_Args) -> | |
| hello(), | |
| Listdir = ls(), | |
| lists:foreach(fun(Elem) -> io:fwrite("~s~n", [Elem]) end, Listdir), | |
| % Boolean | |
| println(true and false), | |
| % atom |
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
| %% modul double | |
| %% | |
| %% cara kompile | |
| %% ```erlang | |
| %% erlc double.erl | |
| %% erl double.beam | |
| %% 1> double:double(10). | |
| %% ``` | |
| -module(double). | |
| %% pub fn double |
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
| defmodule Watcher do | |
| use GenServer | |
| def start_link(args) do | |
| GenServer.start_link(__MODULE__, args) | |
| end | |
| def init(args) do | |
| {:ok, watcher_pid} = FileSystem.start_link(args) | |
| FileSystem.subscribe(watcher_pid) |
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
| defmodule CopyLockWp do | |
| @path System.get_env("USERPROFILE") <> "\\AppData\\Local\\Packages\\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\\LocalState\\Assets" | |
| @dst "D:\\var\\tmp" | |
| def run() do | |
| files = get_files(@path) | |
| dst_dir = @dst <> "\\" <> rand_string() | |
| if !File.exists?(dst_dir) do | |
| File.mkdir_p!(dst_dir) | |
| 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
| defmodule GenBatchCmd do | |
| @template ~s""" | |
| @echo off | |
| uutils.exe <%= cmd %> %* | |
| """ | |
| @dst "c:/Applications/bin" | |
| def main() do | |
| path = Path.expand(".") <> "/lscmd.txt" | |
| cmd = |
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
| location /ecc4/ { | |
| index index1.php; | |
| if (!-e $request_filename) { | |
| rewrite ^(/ecc4/.*)$ /ecc4/index1.php; | |
| } | |
| autoindex on; | |
| client_max_body_size 10M; | |
| } |
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
| extern mod extra; | |
| use extra::json::*; | |
| /* | |
| * This function manages to do absolutely no copying, which is pretty cool. | |
| * | |
| * "What are all those `'r`s?" you ask. Well, they're liftime parameters. They | |
| * indicate how long something lasts (before it's freed). They can't change how | |
| * long something lives for, they only allow you to tell the compiler stuff it |