Skip to content

Instantly share code, notes, and snippets.

View zserge's full-sized avatar

Serge Zaitsev zserge

View GitHub Profile
@zserge
zserge / favicon.ico
Last active January 27, 2018 12:17
GIF recorder
@zserge
zserge / MainActivity.java
Created February 21, 2017 11:32
Reproducing Anvil issue #83
package trikita.foo;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.LinearLayout;
import trikita.anvil.RenderableView;
import static trikita.anvil.DSL.*;
//
// This is just a collection of syscalls that are used by libsctp linux implementation.
// Although it supports message-oriented workflow, it can't be wrapped into a net.PacketConn.
//
package main
import (
"log"
"syscall"
//
// A simple echo server for SCTP sockets, it creates a socket with a syscall then wraps it into a net.Listener interface
// to make goroutine-safe (otherwise reading or writing would block the whole host thread).
// All it does is echoing back all the received data from the client.
//
package main
import (
"fmt"
//
// A simple SCTP echo client to demonstrate wrapping low-level socket file descriptor into a net.Conn.
// Should work fine on linux, darwin, freebsd, dragonfly and solaris (where syscalls are available for SCTP sockets).
//
package main
import (
"errors"
"fmt"
gridLayout()
space()
foregroundLinearLayout()
navigationMenuItemView()
navigationMenuView()
scrimInsetsFrameLayout()
appBarLayout()
collapsingToolbarLayout()
coordinatorLayout()
#!/bin/sh
BGCOLOR='#550000'
TEXTCOLOR='#eeeeee'
TEXTFONT='Ubuntu-Light'
TEXTSIZE=72
TEXT="\nHello this is a very long text\nwrapped in many lines"
# Put screenshot into a frame, change +86+242 if you change a frame PNG
composite -geometry +86+242 $1 frame.png $2
@zserge
zserge / usbhid.js
Created July 31, 2015 10:03
Espruino example
var on = false;
setInterval(function() {
on = !on;
LED1.write(on);
LED2.write(!on);
}, 500);
console.log('Hello, world!');
E.setUSBHID({
@zserge
zserge / MainActivity.java
Created July 28, 2015 13:01
Simple camera example
package com.example.anvil.empty;
import android.app.Activity;
import android.hardware.Camera;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.FrameLayout;
@zserge
zserge / encoding_test.go
Created May 2, 2015 14:12
Benchmarks for various encodings (Gob is the fastest, obviously, JSON is ~4 times slower, CSV is ~10 times slower)
package main
import (
"bytes"
"encoding/csv"
"encoding/gob"
"encoding/json"
"math/rand"
"testing"
)