Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block uDude

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
YongHuax / testAWS
Last active Feb 15, 2018
LG01-P Linux Script to AWSIot
View testAWS
#when connecting to AWSIOT , a cert , privatekey and certificate authority file is required .
#after downloading the cert files when creating a thing , it is possible rename the files so that it is easier to
#call the file when writing the script and cli
#also note that aws things shadow update requires message to be in json to update
#to catch messages sent to things but are rejected due to improper json format , subscribe to things shadow update through mqtt.
# do remember to check the activity page for the AWsiot " thing" u have created to see whether the message is accepted or rejected
uDude / gist:da262b811ba28c8b8204daef5ff5094e
Last active Mar 17, 2018
Iteratively copy files in Elixir
View gist:da262b811ba28c8b8204daef5ff5094e
# We use streams (open the file convert the device to a stream, using 4MB chunks)
# as a demo, using this method we copied a 2.5GB file with no significant memory usage on
# an Odroid with only 2GB of RAM. Not super fast... Do line oriented by replacing the byte
# count in IO.binstream(:line), very very slow. Process line by line or chunk by chunk
# by passing a function to Stream.into(out, fn(line) -> do_someting(line) end).
fin =!("", [:read, :read_ahead]) |> IO.binstream(4194304)
fout =!("file.out", [:write] |> IO.binstream(4194304)
fin |> Stream.into(fout) |>
You can’t perform that action at this time.