1676015760
FirebaseUI is an open-source library for iOS that allows you to quickly connect common UI elements to the Firebase database for data storage, allowing views to be updated in realtime as they change, and providing simple interfaces for common tasks like displaying lists or collections of items.
Additionally, FirebaseUI simplifies Firebase authentication by providing easy to use auth methods that integrate with common identity providers like Facebook, Twitter, and Google as well as allowing developers to use a built in headful UI for ease of development.
FirebaseUI clients are also available for Android and web.
FirebaseUI supports iOS 10.0+ and Xcode 11+. We recommend using CocoaPods, add the following to your Podfile
:
pod 'FirebaseUI', '~> 8.0' # Pull in all Firebase UI features
If you don't want to use all of FirebaseUI, there are multiple subspecs which can selectively install subsets of the full feature set:
# Only pull in Firestore features
pod 'FirebaseUI/Firestore', '~> 8.0'
# Only pull in Database features
pod 'FirebaseUI/Database', '~> 8.0'
# Only pull in Storage features
pod 'FirebaseUI/Storage', '~> 8.0'
# Only pull in Auth features
pod 'FirebaseUI/Auth', '~> 8.0'
# Only pull in Facebook login features
pod 'FirebaseUI/Facebook', '~> 8.0'
# Only pull in Google login features
pod 'FirebaseUI/Google', '~> 8.0'
# Only pull in Phone Auth login features
pod 'FirebaseUI/Phone', '~> 8.0'
If you're including FirebaseUI in a Swift project, make sure you also have:
platform :ios, '10.0'
use_frameworks!
Otherwise, you can include the FirebaseUI Xcode project from this repo in your project. You also need to add the Firebase framework to your project.
The READMEs for components of FirebaseUI can be found in their respective project folders.
If you'd like to contribute to FirebaseUI for iOS, you'll need to run the following commands to get your environment set up:
$ git clone https://github.com/firebase/FirebaseUI-iOS.git
$ cd FirebaseUI-iOS
$ cd Auth # or PhoneAuth, Database, etc
$ pod install
Alternatively you can use pod try FirebaseUI
to install the Objective-C or Swift sample projects.
You'll have to configure your Xcode project in order to run the samples.
Your Xcode project should contain a GoogleService-Info.plist
, downloaded from Firebase console when you add your app to a Firebase project.
Copy the GoogleService-Info.plist
into the sample project folder (samples/obj-c/GoogleService-Info.plist
or samples/swift/GoogleService-Info.plist
).
Update URL Types.
Go to Project Settings -> Info tab -> Url Types
and update values for:
REVERSED_CLIENT_ID
(get value from GoogleService-Info.plist
)fb{your-app-id}
(put Facebook App Id)Update Info.plist
with Facebook configuration values
FacebookAppID -> {your-app-id}
(put Facebook App Id)Enable Keychain Sharing.
Facebook SDK requires keychain sharing.
This can be done here: Project Settings -> Capabilities -> KeyChain Sharing -> ON
Don't forget to configure your Firebase App Database using Firebase console.
Database should contain appropriate read/write permissions and folders (objc_demo-chat
and swift_demo-chat
respectively)
In Order to use Phone Auth
provider you should Configure Push Notifications
Enable silent push notifications in Xcode
Push Notification
- Under Capabilities
tab in your app target choose Push Notifications
and put the switch to the On
position.Background Mode
- Under Capabilities
tab in your app target choose Background Modes
put the switch to the On
position. In the list of available modes select Background fetch
and Remote notifications
(If available).Upload APNS Certificate to Firebase
Create your Provisioning APNS SSL Certificates
by following the steps on the following link. https://firebase.google.com/docs/cloud-messaging/ios/certs
Upload your APNS Certificate
to Firebase:
Project Settings
, and then select the Cloud Messaging
tab.Upload Certificate
button for your development certificate, your production certificate, or both. At least one is required..p12 file
, and provide the password, if any. Make sure the bundle ID
for this certificate matches the bundle ID
of your app. Select Save
.We'd love to accept your sample apps and patches! Before we can take them, we have to jump a couple of legal hurdles.
Please fill out either the individual or corporate Contributor License Agreement (CLA).
Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests.
Author: Firebase
Source Code: https://github.com/firebase/FirebaseUI-iOS
License: Apache-2.0 license
1673348940
Crystal bindings for Hunspell.
Before installing crystal-hunspell
ensure you have hunspell already installed:
Add the dependency to your shard.yml
:
dependencies:
hunspell:
github: mamantoha/crystal-hunspell
Run shards install
require "hunspell"
Open a dictionary:
hunspell = Hunspell.new("/usr/share/hunspell/en_US.aff", "/usr/share/hunspell/en_US.dic")
or
hunspell = Hunspell.new("en_US")
Check if a word is valid:
hunspell.spellcheck("crystal")
# => true
hunspell.spellcheck("cristal")
# => false
Find the stems of a word:
hunsell.stem("fishing")
# => ["fishing", "fish"]
Suggest alternate spellings for a word:
hunspell.suggest("arbitrage")
# => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
Ensure to close Hunspell
instance after using.
hunspell.close
sudo apt install libclang-dev libhunspell-dev
Generate new bindings for Hunspell
crystal ./lib/crystal_lib/src/main.cr src/hunspell/lib_hunspell.cr.in > src/hunspell/lib_hunspell.cr
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Author: Mamantoha
Source Code: https://github.com/mamantoha/crystal-hunspell
License: MIT license
1673345040
Bindings for libncursesw and crt class
Add this to your application's shard.yml
:
dependencies:
crt:
github: maiha/crt.cr
version: 0.4.2
require "crt"
Crt.init
window = Crt::Window.new(5, 21)
window.print(2, 4, "Hello, world!")
window.refresh
sleep 10.seconds
Crt.done
See ./examples/ for more usages.
apt-get install libncursesw5-dev
apt-get install libgpm-dev # needs only for static link
Author: Maiha
Source Code: https://github.com/maiha/crt.cr
License: MIT license
1673337300
Crystal C Bindings for Augeas
Before adding this shard, need to install the libaugeas.
On Mac brew install augeas
On Linux apt-get install libaugeas-dev
Add the dependency to your shard.yml
:
dependencies:
augeas:
github: fernandes/augeas
Run shards install
require "augeas"
Initial step is always setup Augeas to your root path:
augeas = Augeas.new(root: "/path/to/root")
Consider getting value for a postgresql conf setting:
augeas_file = augeas.load_file("/var/lib/pgsql/data/postgresql.conf")
augeas_file.get("data_directory")
# => "/var/lib/postgresql/8.4/main"
augeas_file = augeas.load_file("/var/lib/pgsql/data/postgresql.conf")
augeas_file.set("data_directory", "/my/new/path/to/postgresql/8.4/main")
# => true
augeas.save # this is a important step, do not forget to save
Install the libraries on your local environment, write a spec, make it pass and :shipit:
LibAugeas
has all the methods mapped, the comments there are from the C header.
Augeas needs to pass a pointer to Augeas
on every method, that's why we pass the Augeas
crystal object to Augeas::File
, so we can encapsulate the logic to manipulate a file inside it. We have the penalty on needing to call Augeas#save
, but this is something we can abstract in the future with kind of DSL/block.
This library is on early stages, the next steps are (to be developed as needed):
aug_rm
, aug_mv
, aug_cp
)aug_match
)aug_ns_*
functionsAbout error handling, as we need to check the error messages on Augeas
, the idea is to centralize all the error message / exceptions in one place, for now keeping in one method works, maybe a refactor to a new file can make sense.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Author: Fernandes
Source Code: https://github.com/fernandes/augeas.cr
License: MIT license
1672282020
Crystal bindings to Simple and Fast Multimedia Library.
CrSFML is a library that allows SFML to be used with the Crystal programming language. SFML is a library written in C++, so CrSFML also needs to ship thin C bindings to SFML.
To quote the official site of SFML,
SFML provides a simple interface to the various components of your PC, to ease the development of games and multimedia applications.
Indeed, SFML is most often used to make video games. It provides features such as hardware-accelerated 2D graphics, handling keyboard, mouse and gamepad input, vector and matrix manipulation, managing windows (can also be used as a base for OpenGL drawing), working with multiple image formats, audio playback and recording, basic networking... Check out some demos of CrSFML to see what it can do.
CrSFML consists almost entirely of automatically generated code, based on SFML's header files. Read more about generated code and API differences between SFML and CrSFML.
First, install SFML.
Then create a shard.yml file in your project's folder (or add to it) with the following contents:
name: awesome-game
version: 0.1.0
dependencies:
crsfml:
github: oprypin/crsfml
version: ~> 2.5.2
Resolve dependencies with Shards:
shards install
During installation this will invoke make
to build the C++ wrappers as object files. If that fails, see Custom SFML location.
Try running an example:
cp lib/crsfml/examples/snakes.cr .
crystal snakes.cr
Now you're ready for the tutorials!
Windows
Crystal does not officially support Windows, but CrSFML supports it and is perfectly usable already. See a video detailing the full setup.
The C++ wrappers require a C++ compiler (C++03 will do).
SFML must be installed, with the version that matches SFML_VERSION
in src/version.cr (usually latest). If it doesn't, no need to look for an older release of CrSFML, just re-generate the sources for your version. SFML versions 2.3.x through 2.5.x are supported by CrSFML.
There are detailed official instructions on how to install SFML manually, but on many systems there are easier ways.
If SFML is not installed in a global/default location, see Custom SFML location.
Linux
Many Linux-based systems provide SFML through their package manager. Make sure to install the -dev packages if there is such a separation in your Linux distribution of choice.
Note that most often the packages provided by Linux distributions are outdated. If you're installing an older version of SFML (not recommended), make sure that it's still supported by CrSFML. You will need to re-generate the sources.
Mac
The easiest way to install SFML on macOS is through the Homebrew package manager:
brew update
brew install sfml
It can also be installed by copying binaries, as described in official instructions.
Windows
Downloading the official binaries ("Visual C++ 15 (2017) - 64-bit") will do. Check out the video on how to set things up on Windows.
From source
Building SFML from source is as simple as downloading the source code and running:
cmake .
cmake --build .
sudo make install # optional!
In some cases the dependencies are bundled with SFML, otherwise see the official build instructions.
If SFML's headers and libraries are not in a path where the compiler would look by default (and the defaults usually work only on Linux), additional steps are needed.
First, before building the extensions (make
) or generating sources, you need to configure the include path:
export SFML_INCLUDE_DIR=/full/path/to/sfml/include
Windows equivalent:
set INCLUDE=C:\path\to\sfml\include;%INCLUDE%
Setting these variables beforehand can also fix shards install
.
Then, whenever using CrSFML, you need to configure the path to SFML libraries so the linker can find them. To apply these for the current shell session, run:
export LIBRARY_PATH=/full/path/to/sfml/lib # Used during linking
export LD_LIBRARY_PATH=/full/path/to/sfml/lib # Used when running an executable
Windows equivalent:
set LIB=c:\path\to\sfml\lib;%LIB%
set PATH=c:\path\to\sfml\bin;%PATH%
CrSFML's top-level scripts also need the include path to work. E.g. crystal generate.cr -- /full/path/to/sfml/include
.
CrSFML's sources come almost entirely from a generator program. They are based on a particular version of SFML. But as sources for the latest version are already bundled, usually you don't need to do this. More details.
As this is out of scope for Shards, let's download the repository separately (then use CrSFML without Shards).
git clone https://github.com/oprypin/crsfml
cd crsfml
Then we can generate the sources, either directly with crystal generate.cr
or as part of the build process:
touch generate.cr
make
If run successfully, this generates all the source files and also compiles the C++ wrapper.
It's also possible to use CrSFML outside of Shards, as with any library. One option is to directly create a symbolic link to CrSFML in your project's lib folder.
mkdir lib
ln -s /full/path/to/crsfml lib/crsfml
Another option is to export CRYSTAL_PATH=/full/path/to
a directory that contains the crsfml directory.
The API of CrSFML (a library for Crystal) attempts to be similar to SFML (a C++ library), but some general changes are present:
snake_case
.x.getSomeProperty()
becomes x.some_property
.x.isSomeProperty()
, x.hasSomeProperty()
become x.some_property?
.x.setSomeProperty(v)
becomes x.some_property = v
.my_struct.x = 7
is fine but array_of_structs[2].x = 5
will not work. To work around this, copy the whole struct, modify it, then write it back. Better yet, avoid the need to modify structs (work with them like with immutable objects).loadFromFile
, that are used for initialization, each have a corresponding shorthand class method (from_file
) that raises SF::InitError
on failure.|
operator.SF::Keyboard::Code::Slash
you can use SF::Keyboard::Slash
.Event
union and EventType
enum are represented as a class hierarchy. Instead of ev.type == SF::Event::Resized
use ev.is_a?(SF::Event::Resized)
; instead of ev.size.width
use ev.width
.Drawable
, include the Drawable
module with an abstract draw
method.The interface of the C++ → C wrapper (which Crystal ultimately binds to) consists entirely of simple functions that accept only native types (such as float
, uint32_t
, char*
) and untyped pointers (void*
). The untyped pointers are never exposed to the user, only to other auto-generated parts of the code. The function names consist of the original SFML class name, the function name itself, and a base62 hash of the parameter types. Return types are never used; instead, the output is done into a pointer (which is usually the last argument of the function), but, as usual, the memory allocation is the caller's job. The first argument of each function is a pointer to the receiver object (if applicable).
Abstract classes are implemented by exposing a collection of global callback variables, which must be set by the user if they want to use the corresponding class. The callback's first argument is the object, and some arguments are pointers that need to be assigned to inside the callback implementation (because return values are not used).
Compilation of the C++ extensions is based only on SFML's header files, these are made into object files, and all the linking is deferred to the final linker invocation done by Crystal.
CSFML is a great library that allows SFML to be used with C. It goes to great lengths to be human-friendly and does a good job of converting C++ idioms to C idioms. In the past CrSFML used to be based on it, but after a while it became apparent that the advantages of CSFML's nice interface are also disadvantages when constructing (especially auto-generated) bindings that attempt to look as close to the real SFML as possible.
Many details about functions' signatures are lost, as well as function overloads. Names of data types had to be simplified (not namespaced). And many other such small things that bring the frustration of having to reconstruct the details of the original SFML interface based on the simplified CSFML interface.
There are many aspects that prevent an efficient implementation from the standpoint of bindings, most importantly, CSFML takes memory allocation into its own hands, so any object creation in CrSFML involved allocation of two objects on the heap by two different libraries, and every interaction with it had to go through at least two pointers. Structs in CSFML are actually completely separate data types and they have to be constantly be converted between a "SFML-struct" and a "CSFML-struct".
Instead of that, the C++ → C wrapper passes the bare SFML data types directly through untyped pointers, and relies on the higher-level binding to deal safely with them. In case of structs the data layout is mirrored, in case of classes the pointers remain completely opaque.
Not to forget that the wrapper is made automatically, so it can be quickly updated to any SFML release and prevents human error that could happen when implementing CSFML.
CrSFML was made by Oleh Prypin.
CrSFML is licensed under the terms and conditions of the zlib/libpng license.
This library uses and is based on SFML.
Thanks to Alan Willms for translating tutorials to Crystal.
Author: Oprypin
Source Code: https://github.com/oprypin/crsfml
License: Zlib license
1667513460
Chipmunk.jl
is a Julia binding of the popular physics engine [Chipmunk] (https://chipmunk-physics.net/) ([Github page] (https://github.com/slembcke/Chipmunk2D)). This is currently very much in progress.
Take a look at the examples/
folder to see what you can do with Chipmunk.jl
Chipmunk.jl
uses [SFML.jl] (https://github.com/zyedidia/SFML.jl) to render the world to the screen.
Chipmunk.jl
also requires Julia 0.4.
Installation
Installation is quite simple. The package will clone and install chipmunk from source to deps/
. Make sure that you have cmake
installed so that it can build chipmunk.
I have not been able to get cmake to compile Chipmunk on Windows yet.
If you get an SFML build error about follow_symlinks
you should update your version of Julia 0.4.
julia> Pkg.clone("https://github.com/zyedidia/Chipmunk.jl")
julia> Pkg.build("Chipmunk")
Author: Zyedidia
Source Code: https://github.com/zyedidia/Chipmunk.jl
License: View license
1666949460
NLopt bindings for julia. See here for the documentation of nlopt.
Example using a L-BFGS optimizer. The objective function returns a tuple where the first value contains the function evaluation and the second the gradient evaluation.
x = [-1.2,1,-1.2,1]
function obj(x)
fx = 0
g = Array(Float64,length(x))
for i = 1:2:length(x)
f1 = 1-x[i]
f2 = 10* (x[i+1] - x[i]^2)
g[i+1] = 20.0 * f2
g[i] = -2.0 * (x[i] * g[i+1] + f1)
fx += f1^2 + f2^2
end
return (fx,g)
end
nlopt_optimize(NLopt(:ld_lbfgs,
:ftol_abs, 1e-8,
:maxeval, 2000,
:min_objective, obj), x)
Author: MetalNinjas
Source Code: https://github.com/MetalNinjas/julia-nlopt
License: MIT license
1666112940
This package provides Julia bindings to the FFTW library for fast Fourier transforms (FFTs), as well as functionality useful for signal processing. These functions were formerly a part of Base Julia.
]add FFTW
using FFTW
fft([0; 1; 2; 1])
returns
4-element Array{Complex{Float64},1}:
4.0 + 0.0im
-2.0 + 0.0im
0.0 + 0.0im
-2.0 + 0.0im
The documentation of generic FFT functionality can be found in the AbstractFFTs.jl package. Additional functionalities supported by the FFTW library are documented in the present package.
Alternatively, the FFTs in Intel's Math Kernel Library (MKL) can be used by running FFTW.set_provider!("mkl")
. MKL will be provided through MKL_jll
. This change of provider is persistent and has to be done only once, i.e., the package will use MKL when building and updating. Note however that MKL provides only a subset of the functionality provided by FFTW. See Intel's documentation for more information about potential differences or gaps in functionality. In case MKL does not fit the needs (anymore), FFTW.set_provider!("fftw")
allows to revert the change of provider.
Author: JuliaMath
Source Code: https://github.com/JuliaMath/FFTW.jl
License: MIT license
1665345480
This package provides bindings to the Intel MKL Vector Mathematics Functions. This is often substantially faster than broadcasting Julia's built-in functions, especially when applying a transcendental function over a large array. Until Julia 0.6 the package was registered as VML.jl
.
Similar packages are Yeppp.jl, which wraps the open source Yeppp library, and AppleAccelerate.jl, which provides access to macOS's Accelerate framework.
There is currently the following issue between the CompilerSupportLibraries_jll
artifact, which is used for example by SpecialFunctions.jl
, and MKL_jll
. Unless MKL_jll
is loaded first, there might be wrong results coming from a small number of function for particular input array lengths. If you are unsure which, if any, your used packages might load this artifact, loading IntelVectorMath
as the very first package should be fine.
To install IntelVectorMath.jl run
julia> ] add IntelVectorMath
Since version 0.4 IntelVectorMath
uses the MKL_jll
artifact, which is shared with other packages uses MKL, removing several other dependencies. This has the side effect that from version 0.4 onwards this package requires at least Julia 1.3.
For older versions of Julia IntelVectorMath v0.3
downloads its own version of MKL and keeps only the required files in its own directory. As such installing MKL.jl or MKL via intel are no longer required, and may mean some duplicate files if they are present. However, this package will adopt the new artifact system in the next minor version update and fix this issue. In the event that MKL was not installed properly you will get an error when first using
it. Please try running
julia> ] build IntelVectorMath
If this does not work, please open an issue and include the output of <packagedir>/deps/build.log
.
If you used this package prior to its renaming, you may have to run ] rm VML
first. Otherwise there will be a conflict due to the UUID.
After loading IntelVectorMath
, you have the supported function listed below, for example IntelVectorMath.sin(rand(100))
. These should provide a significant speed-up over broadcasting the Base functions. Since the package name is quite long, an alias IVM
is also exported to allow IVM.sin(rand(100))
after using
the package. If you import
the package, you can add this alias via const IVM = IntelVectorMath
. Equally, you can replace IVM
with another alias of your choice.
julia> using IntelVectorMath, BenchmarkTools
julia> a = randn(10^4);
julia> @btime sin.($a); # apply Base.sin to each element
102.128 μs (2 allocations: 78.20 KiB)
julia> @btime IVM.sin($a); # apply IVM.sin to the whole array
20.900 μs (2 allocations: 78.20 KiB)
julia> b = similar(a);
julia> @btime IVM.sin!(b, a); # in-place version
20.008 μs (0 allocations: 0 bytes)
By default, IntelVectorMath uses VML_HA
mode, which corresponds to an accuracy of <1 ulp, matching the accuracy of Julia's built-in openlibm implementation, although the exact results may be different. To specify low accuracy, use vml_set_accuracy(VML_LA)
. To specify enhanced performance, use vml_set_accuracy(VML_EP)
. More documentation regarding these options is available on Intel's website.
Summary of Results:
Relative speed of IntelVectorMath/Base: The height of the bars is how fast IntelVectorMath is compared to using broadcasting for functions in Base
Full Results:
Real Functions - Full Benchmark Results
Complex Functions - Full Benchmark Results
Real Functions - Performance over dimensions
Tests were performed on an Intel(R) Core(TM) i5-8250U @ 1.6 [GHz] 1800 Mhz. The dashed line indicates equivalent performance for IntelVectorMath versus the implementations in Base.
IntelVectorMath.jl supports the following functions, most for Float32 and Float64, while some also take complex numbers.
Allocating forms have signature f(A)
. Mutating forms have signatures f!(A)
(in place) and f!(out, A)
(out of place). The last 9 functions have been moved from Base to SpecialFunctions.jl
or have no Base equivalent.
Allocating | Mutating |
---|---|
acos | acos! |
asin | asin! |
atan | atan! |
cos | cos! |
sin | sin! |
tan | tan! |
acosh | acosh! |
asinh | asinh! |
atanh | atanh! |
cosh | cosh! |
sinh | sinh! |
tanh | tanh! |
cbrt | cbrt! |
sqrt | sqrt! |
exp | expm1! |
log | log! |
log10 | log10! |
log1p | log1p! |
abs | abs! |
abs2 | abs2! |
ceil | ceil! |
floor | floor! |
round | round! |
trunc | trunc! |
erf | erf! |
erfc | erfc! |
erfinv | erfinv! |
efcinv | efcinv! |
gamma | gamma! |
lgamma | lgamma! |
inv_cbrt | inv_cbrt! |
inv_sqrt | inv_sqrt! |
pow2o3 | pow2o3! |
pow3o2 | pow3o2! |
Allocating forms have signature f(A, B)
. Mutating forms have signature f!(out, A, B)
.
Allocating | Mutating |
---|---|
atan | atan! |
hypot | hypot! |
pow | pow! |
divide | divide! |
Next steps for this package
IntelVectorMath.jl uses CpuId.jl to detect if your processor supports the newer avx2
instructions, and if not defaults to libmkl_vml_avx
. If your system does not have AVX this package will currently not work for you. If the CPU feature detection does not work for you, please open an issue.
Author: JuliaMath
Source Code: https://github.com/JuliaMath/IntelVectorMath.jl
License: View license
1665250440
Julia bindings for libFLAC
Integration through FileIO makes loading and saving easy:
data, fs = load("input.flac")
data = data * 2
save("output.flac", data, fs)
save()
can also take extra keyword parameters such as bits_per_sample
and compression_level
if such parameters are important. More advanced usage is possible through the use of the FLACDecoder
API, which allows for, among other things, seeking within .flac
streams and decoding segments of streams.
Author: JuliaIO
Source Code: https://github.com/JuliaIO/FLAC.jl
License: View license
1665087060
This package provides an interface to the the GraphViz
package for graph visualization. There are two primary entry points:
GraphViz.load
function (not exported) to load graphs from a filedot"""
string macro for literal inline specifications of graphsBoth of these accept Graph
type accepts graph in DOT format. To load a graph from a non-constant string, use GraphViz.load
with an IOBuffer
.
Getting started
If you already have a graph you would like to work with, the following code snippets may be helpful. If not, have a look at the "Simple Examples" section below
using GraphViz
GraphViz.load("mygraph.dot")
dot"""
digraph graphname {
a -> b -> c;
b -> d;
}
""")
Usage
After obtaining the package through the package manager, the following suffices to load the package:
using GraphViz
Note that graphviz has many configuration options. In particular, both the Cairo and the GTK backends may be disabled by default.
Simple Examples
Try the following in an IJulia Notebook (this example is taken from here):
dot"""
graph graphname {
// The label attribute can be used to change the label of a node
a [label="Foo"];
// Here, the node shape is changed.
b [shape=box];
// These edges both have different line properties
a -- b -- c [color=blue];
b -- d [style=dotted];
}
"""
Author: JuliaGraphs
Source Code: https://github.com/JuliaGraphs/GraphViz.jl
License: View license
1665069260
This is a binding of the C++ game and multimedia library SFML (Simple and Fast Multimedia Library), developed by Laurent Gomila, for Julia. SFML is often used for game development but it can be used for anything graphics-related.
It also has audio libraries and networking libraries.
There is currently almost complete support for graphics, great support for audio, and complete support for network.
SFML.jl works on Mac OS X, Linux, and Windows.
Take a look at the examples
folder to see some usage examples.
For much larger examples (games) see these two examples: Jumping Game and Space Shooter (this one is more complex).
You can view a talk I gave about SFML.jl at JuliaCon 2015 here. All the demos that I used in that talk are available in the JuliaCon-SFML repository.
Installation
To install on any OS, run:
julia> Pkg.add("SFML")
If you want to install the master version use:
julia> Pkg.clone("SFML")
julia> Pkg.build("SFML")
Please make sure you have Glibc 2.14 installed, and let me know if there are any build problems on Linux (I don't use Linux very much). The Linux binaries don't come with any of the dependencies so you have to install them yourself. Here is the list:
On Debian you can install the package libsfml-dev
which will also install all dependencies. You can also run the commands here (you don't need to install cmake-gui).
Screenshots and Gifs
It is very simple to take a screen shot using SFML. Just use screenshot(window, filename)
.
You can also take a screenshot and store it in an Image
object without saving the image using image = capture(window)
To create a gif, you must have imagemagick installed.
Making gifs is only slightly more complicated. You can use the make_gif(window, width, height, duration, filename, delay)
function (duration and delay are in seconds).
When you run the program, it will asynchronously create the gif and will give you constant feedback in the console. If you don't see anything in the console, add a sleep(0)
declaration at the start of the animation loop to allow Julia time to switch between the processes.
The gif creation is done when it says Created gif XXX.gif
.
What has not been bound (yet)
For the first three, we will probably have to wait for Julia to support multithreading.
Author: Zyedidia
Source Code: https://github.com/zyedidia/SFML.jl
License: View license
1664814541
Fontconfig.jl provides basic binding to fontconfig.
Pattern
Pattern
corresponds to the fontconfig type FcPattern
. It respresents a set of font properties used to match specific fonts.
It can be constructed in two ways. First with zero or more keyword arguments corresponding to fontconfig font properties.
Fontconfig.Pattern(; args...)
For example
Fontconfig.Pattern(family="Helvetica", size=10, hinting=true)
Secondly, it can be constructed with a fontconfig specifications string
Fontconfig.Pattern(name::String)
For example
Fontconfig.Pattern("Helvetica-10")
Match
The primary functionality fontconfig provides is matching font patterns. In Fontconfig.jl this is done with the match
function, corresponding to FcMatch
in fontconfig.
match(pat::Pattern)
It takes a Pattern
and return a Pattern
corresponding to the nearest matching installed font.
Format
Extracting property values from a Pattern
can be done with the format
function, which wraps FcPatternFormat
.
format(pat::Pattern, fmt::String="%{=fclist}")
See man FcPatternFormat
for the format string specification.
List
Fontconfig also provides a function list
to enumerate all installed fonts. Optionally, a Pattern
can be provided to list just matching fonts. The function will return a vector of Pattern
s
list(pat::Pattern=Pattern())
Author: JuliaGraphics
Source Code: https://github.com/JuliaGraphics/Fontconfig.jl
License: View license
1664802780
DevIL / OpenIL binding for Julia
Lib version: 1.7.8
Currently only IL is bound, ILU and ILUT are not.
If you don't read the docs, at least read this: you need to call ilInit()
before calling any other IL functions, otherwise it might crash your session with null pointer access.
Here's what a typical cycle of loading an image looks like:
using DevIL
ilInit()
ilBindImage(ilGenImage())
ilLoadImage("example.png")
w = ilGetInteger(IL_IMAGE_WIDTH)
h = ilGetInteger(IL_IMAGE_HEIGHT)
dataPtr = ilGetData()
# do stuff with the image data and when we're done
ilDeleteImage(ilGetInteger(IL_CUR_IMAGE))
# when we're done with the library
ilShutDown()
For usage information & documentation please visit http://openil.sourceforge.net/
Author: JuliaGL
Source Code: https://github.com/JuliaGL/DevIL.jl
License: View license
1661836223
binding and high-level wrapper on top of libssh - The SSH library! libssh is a multiplatform C library implementing the SSHv2 protocol on client and server side. With libssh, you can remotely execute programs, transfer files, use a secure and transparent tunnel https://www.libssh.org
linux (Debin/Ubuntu)
# install dart 2.14
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dart=2.14*
# install libssh
sudo apt show libssh-4
sudo apt install libssh-4
# check
ldconfig -p | grep libssh
/lib/x86_64-linux-gnu/libssh.so.4
libssh.so.4
example of high level on Ubuntu 20
void main() async {
var libraryPath = path.join('/lib/x86_64-linux-gnu/', 'libssh.so.4');
print('libraryPath $libraryPath');
final dll = DynamicLibrary.open(libraryPath);
final libssh = LibsshWrapper('192.168.3.4',
inDll: dll,
username: 'isaque',
password: 'pass',
port: 22,
verbosity: true);
libssh.connect();
final start = DateTime.now();
await libssh.scpDownloadDirectory('/var/www/html/portalPmro',
path.join(Directory.current.path, 'download'));
print('\r\n${DateTime.now().difference(start)}');
libssh.dispose();
exit(0);
}
example of low level on Windows
import 'dart:io';
import 'package:libssh_binding/libssh_binding.dart';
import 'package:libssh_binding/src/extensions/sftp_extension.dart';
import 'dart:ffi' as ffi;
import 'package:path/path.dart' as path;
void main() async {
// Open the dynamic library
var libraryPath = path.join(Directory.current.path, 'libssh_compiled', 'ssh.dll');
final dll = ffi.DynamicLibrary.open(libraryPath);
var libssh = Libssh(dll);
var host = "localhost";
var port = 22;
var password = "pass";
var username = "root";
// Abra a sessão e define as opções
var my_ssh_session = libssh.ssh_new();
libssh.ssh_options_set(my_ssh_session, ssh_options_e.SSH_OPTIONS_HOST, stringToNativeVoid(host));
libssh.ssh_options_set(my_ssh_session, ssh_options_e.SSH_OPTIONS_PORT, intToNativeVoid(port));
//libssh.ssh_options_set(my_ssh_session, ssh_options_e.SSH_OPTIONS_LOG_VERBOSITY, intToNativeVoid(SSH_LOG_PROTOCOL));
libssh.ssh_options_set(my_ssh_session, ssh_options_e.SSH_OPTIONS_USER, stringToNativeVoid(username));
// Conecte-se ao servidor
var rc = libssh.ssh_connect(my_ssh_session);
if (rc != SSH_OK) {
print('Error connecting to host: $host\n');
}
rc = libssh.ssh_userauth_password(my_ssh_session, stringToNativeInt8(username), stringToNativeInt8(password));
if (rc != ssh_auth_e.SSH_AUTH_SUCCESS) {
var error = libssh.ssh_get_error(my_ssh_session.cast());
print("Error authenticating with password:$error\n");
//ssh_disconnect(my_ssh_session);
//ssh_free(my_ssh_session);
}
String resp = '';
// resp = libssh.execCommand(my_ssh_session, 'ls -l');
//print("$resp");
/*resp = libssh.execCommand(my_ssh_session, 'cd /var/www/dart && ls -l');
print("$resp");*/
/*resp = libssh.scpReadFileAsString(my_ssh_session, '/home/isaque.neves/teste.txt');
print('$resp');*/
/*await libssh.scpDownloadFileTo(
my_ssh_session, '/home/isaque.neves/teste.txt', path.join(Directory.current.path, 'teste.txt'));*/
/*await libssh.sftpCopyLocalFileToRemote(
my_ssh_session, path.join(Directory.current.path, 'teste.mp4'), '/home/isaque.neves/teste.mp4');*/
await libssh.sftpDownloadFileTo(my_ssh_session, '/home/isaque.neves/teste.mp4', path.join(Directory.current.path, 'teste.mp4'));
libssh.ssh_disconnect(my_ssh_session);
libssh.ssh_free(my_ssh_session);
exit(0);
}
example of high level on Windows
import 'package:libssh_binding/libssh_binding.dart';
void main() {
final libssh = LibsshWrapper('localhost', username: 'root', password: 'pass', port: 22);
libssh.connect();
final start = DateTime.now();
//download file via SCP
/*await libssh.scpDownloadFileTo('/home/isaque.neves/go1.11.4.linux-amd64.tar.gz',
path.join(Directory.current.path, 'go1.11.4.linux-amd64.tar.gz'), callbackStats: (total, loaded) {
var progress = ((loaded / total) * 100).round();
stdout.write('\r');
stdout.write('\r[${List.filled(((progress / 10) * 4).round(), '=').join()}] $progress%');
});*/
//execute command
var re = libssh.execCommandSync('cd /var/www; ls -l');
print(re);
//execute command in shell
//var re = libssh.execCommandsInShell(['cd /var/www', 'ls -l']);
//print(re.join(''));
//download file via SFTP
/* await libssh.sftpDownloadFileTo(my_ssh_session, '/home/isaque.neves/go1.11.4.linux-amd64.tar.gz',
path.join(Directory.current.path, 'go1.11.4.linux-amd64.tar.gz'));*/
//download directory recursive
await libssh.scpDownloadDirectory('/var/www',
path.join(Directory.current.path, 'download'));
print('${DateTime.now().difference(start)}');
libssh.dispose();
}
if you want to compile libssh for android see this link Compiling libssh for Android if you need it for ios see this link libssh2 for ios, it's not for libssh, it's for libssh2 but possibly the hints should be for libssh too
Run this command:
With Dart:
$ dart pub add libssh_binding
With Flutter:
$ flutter pub add libssh_binding
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get
):
dependencies:
libssh_binding: ^1.0.0
Alternatively, your editor might support dart pub get
or flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:libssh_binding/libssh_binding.dart';
example/main.dart
import 'dart:io';
import 'package:libssh_binding/libssh_binding.dart';
import 'package:path/path.dart' as path;
void main() async {
final libssh = LibsshWrapper('localhost',
username: 'user', password: 'pass', port: 22, verbosity: false);
libssh.connect();
final start = DateTime.now();
///var/www/html/portal2018_invadido.tar.gz
//download file via SCP
/*await libssh.scpDownloadFileTo('/home/isaque.neves/go1.11.4.linux-amd64.tar.gz',
path.join(Directory.current.path, 'go1.11.4.linux-amd64.tar.gz'), callbackStats: (total, loaded) {
//var progress = ((loaded / total) * 100).round();
//stdout.write('\r');
//stdout.write('\r[${List.filled(((progress / 10) * 4).round(), '=').join()}] $progress%');
});*/
await libssh.scpDownloadDirectory('/var/www/html/portalPmro',
path.join(Directory.current.path, 'download'));
/*var re = libssh.execCommandSync('cd /var/www; ls -l');
print(re);*/
/*var re = libssh.sftpListDir('/var/www');
print(re.join('\r\n'));*/
//var re = libssh.execCommandsInShell(['cd /var/www', 'ls -l']);
//print(re.join(''));
/* await libssh.sftpDownloadFileTo(my_ssh_session, '/home/isaque.neves/go1.11.4.linux-amd64.tar.gz',
path.join(Directory.current.path, 'go1.11.4.linux-amd64.tar.gz'));*/
/*await libssh.sftpCopyLocalFileToRemote(
my_ssh_session, path.join(Directory.current.path, 'teste.mp4'), '/home/isaque.neves/teste.mp4');*/
//sleep(Duration(seconds: 20));
//print(path.join(Directory.current.path, 'go1.11.4.linux-amd64.tar.gz'));
/*var sftp = libssh.initSftp(my_ssh_session);
for (var i = 0; i < 10; i++) {
await libssh.sftpDownloadFileTo(my_ssh_session, '/home/isaque.neves/go1.11.4.linux-amd64.tar.gz',
path.join(Directory.current.path, 'go1.11.4.linux-amd64.tar.gz'),
inSftp: sftp);
}*/
print('\r\n${DateTime.now().difference(start)}');
libssh.dispose();
exit(0);
}
Author: insinfo
Source Code: https://github.com/insinfo/libssh_binding
License: MIT license