Skip to content

Instantly share code, notes, and snippets.

View stanbar's full-sized avatar
👨‍🎓
Researching blockchain-based voting

Stanislaw Baranski stanbar

👨‍🎓
Researching blockchain-based voting
View GitHub Profile
@xaverkapeller
xaverkapeller / SortedListAdapter.java
Last active November 16, 2020 05:33
Implementation of a RecyclverView Adapter base class which uses a SortedList internally
import android.content.Context;
import android.support.v7.util.SortedList;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
Copyright 2015 Brian Smith.
One Way to do Multi-precision Multiplication
============================================
@sv0
sv0 / how-to-fix-tmux-fail.md
Last active February 20, 2022 18:51
How to fix tmux error "terminal open failed: missing or unsuitable terminal: rxvt-unicode-256color"

If tmux fails with an error terminal open failed: missing or unsuitable terminal: rxvt-unicode-256color

log in to your remote host and create .terminfo/r in your home directory:

mkdir -p ~/.terminfo/r

copy terminal information file to remote machine:

scp /usr/share/terminfo/r/rxvt-unicode* remote.host:~/.terminfo/r/

@LouisCAD
LouisCAD / LifecycleCoroutines.kt
Last active July 3, 2022 11:47
CoroutineScope and Job integration with Lifecycle for Android. Meant to be used for your coroutines in lifecycle aware components. OUTDATED. See up to date implementation here: https://github.com/LouisCAD/Splitties/tree/master/modules/lifecycle-coroutines
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.Main
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job {
@johansten
johansten / blindsig.py
Created February 29, 2020 11:50
ed25519 chaumian blind signatures
from scalar import Scalar
from ed25519 import G, KeyPair, challenge
from group_element import GroupElement
class IssuerSession(object):
def __init__(self, kp):
self.x = kp.x
self.P = kp.P
self.k = Scalar.random()
@bcremer
bcremer / gist:12167985b442d0d195de
Created August 5, 2014 12:01
NGINX as caching REST-API Proxy
upstream backend {
server localhost:8080;
#server backup1.example.com:8080 backup;
#server backup2.example.com:8080 backup;
}
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:10m;
# Set cache key to include identifying components
@kevinwright
kevinwright / arch-firstboot.md
Last active October 25, 2023 08:28
Arch first-boot configuration. Setup the first user, sudo, vm tools, and enough of a dev env to support AUR+yaourt

OpenSSH daemon

pacman -S openssh
systemctl start sshd
systemctl enable sshd.socket

Sudoers

@zmilonas
zmilonas / GDPR_CV.md
Last active January 14, 2024 19:04
Formułka do CV, resume, RODO GDPR Compliant resume formulae

Polski 🇵🇱

Wyrażam zgodę na przetwarzanie moich danych osobowych w celu rekrutacji zgodnie z art. 6 ust. 1 lit. a Rozporządzenia Parlamentu Europejskiego i Rady (UE) 2016/679 z dnia 27 kwietnia 2016 r. w sprawie ochrony osób fizycznych w związku z przetwarzaniem danych osobowych i w sprawie swobodnego przepływu takich danych oraz uchylenia dyrektywy 95/46/WE (ogólne rozporządzenie o ochronie danych)

English 🇪🇺

I hereby give consent for my personal data included in my application to be processed for the purposes of the recruitment process under the European Parliament's and Council of the European Union Regulation on the Protection of Natural Persons as of 27 April 2016, with regard to the processing of personal data and on the free movement of such data, and repealing Directive 95/46/EC (Data Protection Directive)

@felHR85
felHR85 / SoftKeyboard.java
Last active February 17, 2024 23:11
A solution to catch show/hide soft keyboard events in Android http://felhr85.net/2014/05/04/catch-soft-keyboard-showhidden-events-in-android/
/*
* Author: Felipe Herranz (felhr85@gmail.com)
* Contributors:Francesco Verheye (verheye.francesco@gmail.com)
* Israel Dominguez (dominguez.israel@gmail.com)
*/
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import android.os.Handler;
@enepomnyaschih
enepomnyaschih / base64.js
Last active March 6, 2024 23:45
https://www.npmjs.com/package/byte-base64 - Encode JS Uint8Array, simple array of bytes or native JS string to base64 and back
/*
MIT License
Copyright (c) 2020 Egor Nepomnyaschih
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is