Skip to content

Instantly share code, notes, and snippets.

View Altai-man's full-sized avatar

Altai-man

  • Edument Central Europe sro.
View GitHub Profile
import random
import string
import requests
import json
def main():
host = "http://127.0.0.1:8000/api/v1"
api_key = "value_here"
filename = "filename_here"
from i3pystatus import Status
status = Status(standalone=True)
# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
# ^-- calendar week
status.register("clock",
format=" %X ",)
@Altai-man
Altai-man / Example.pl6
Last active January 9, 2016 10:41
Native call expected return type with CArray representation, but got a VMArray
use v6;
use NativeCall;
# Needed bindings.
our sub fopen(Str $filename, Str $mode) returns OpaquePointer is
native() { ... }
our sub close(OpaquePointer $handle) is native() { ... }
# Bingings to bzip2(only needed parts).
our sub BZ2_bzWriteOpen(Pointer[int32], OpaquePointer, int32, int32, int32) returns OpaquePointer is native("/lib/libbz2.so.1") is export { * }
use v6;
use NativeCall;
sub fopen(Str $filename, Str $mode) returns OpaquePointer is native() is export { * }
sub call(Str $way, bool $is-read) { # bool from NativeCall.
if $is-read {
fopen($way, "r");
} else {
fopen($way, "w");
@Altai-man
Altai-man / gist.txt
Created April 29, 2017 05:04
Missing native libraries or so
1 Cannot locate native library 'libgumbo.so.1': libgumbo.so.1: cannot open shared object file: No such file or directory
2 Cannot locate native library 'liblibSDL.so': liblibSDL.so: cannot open shared object file: No such file or directory
3 # Cannot locate native library 'liblmdb.so.0.0.0': liblmdb.so.0.0.0: cannot open shared object file: No such file or directory
4 Cannot locate native library 'liblmdb.so.0.0.0': liblmdb.so.0.0.0: cannot open shared object file: No such file or directory
5 Cannot locate native library 'liblua5.1.so': liblua5.1.so: cannot open shared object file: No such file or directory
6 Cannot locate native library 'libMagickWand.so': libMagickWand.so: cannot open shared object file: No such file or directory
7 # Cannot locate native library 'libmarkdown.so': libmarkdown.so: cannot open shared object file: No such file or directory
8 Cannot locate native library 'libnotmuch.so': libnotmuch.so: cannot open shared object file: No such file or direct
➜ 1 git:(master) zef --installed list
===> Found via /home/sena/.rakudobrew/moar-nom/install/share/perl6
CORE:ver('6.c'):auth('perl')
===> Found via /home/sena/.rakudobrew/moar-nom/install/share/perl6/site
JSON::Fast:ver('0.9.1') # === Here it is, nice and clear;
JSON::Marshal:ver('0.0.11'):auth('github:jonathanstowe') # === And the last version is here too.
OpenSSL:ver('0.1.11'):auth('github:sergot')
zef:ver('0.1.25'):auth('github:ugexe')
JSON::Name:ver('0.0.2'):auth('github:jonathanstowe')
➜ 1 git:(master) perl6
my $c = Channel.new;
my $end = $c.closed;
# Example of task to keep channel busy
supply { # Don't forget to pull items from the channel, otherwise $close will not be kept.
for (0..2) { {$c.close;done} if $_ == 2; .say; sleep 0.5; }
}.tap;
my $timeout = Promise.in(5);
my $timeout-or-good = Promise.anyof($end, $timeout);
await $timeout-or-good.then(

List of missing native libraries

  • libfann.so
  • liblbfgs.so
  • mpd is not installed and run
  • archive (libarchive)
  • mp3lame
  • shout
  • libvorbis
  • libtag_c.so
use Cro::WebSocket::Client;
use Cro::HTTP::Router;
use Cro::HTTP::Router::WebSocket;
use Cro::HTTP::Server;
my $application = route {
get -> 'chat' {
web-socket(-> $incoming {
supply {
whenever $incoming -> $message { # This will be executed even after server's `stop` call
func gen(nums ...int) <-chan int {
out := make(chan int)
go func() {
for _, n := range nums {
out <- n
}
close(out)
}()
return out
}