Skip to content

Instantly share code, notes, and snippets.

post_install() {
_VERSION=1710
_EXECUTABLE=SailfishOSSDK-Beta-${_VERSION}-Qt5-linux-64-offline.run
_PATH=/usr/share/sailfishos-sdk-bin
_USER=`cat /usr/share/sailfishos-sdk-bin/username.txt`
chown ${_USER}:users ${_PATH}/${_EXECUTABLE}
sudo -u ${_USER} chmod +x ${_PATH}/${_EXECUTABLE}
@marmistrz
marmistrz / PKGBUILD
Last active January 3, 2018 10:19
PKGBUILD for SailfishOS SDK
# Maintainer: degreeme <suratovvlad@gmail.com>
# Contributor: Van-ess0 <van-ess0@mail.ru>
# Contributor: Marcin Mielniczuk <marmistrz.dev at zoho dot eu>
pkgname=sailfishos-sdk-bin
pkgver=1710
pkgrel=1
pkgdesc="SailfishOS SDK is a collection of tools for developing SailfishOS applications."
arch=('x86_64')
url="https://sailfishos.org/"
@marmistrz
marmistrz / binom.py
Created September 22, 2017 10:23
binom.py
from scipy.stats import binom
for n in range(5, 200, 5): # size of the committee
max_bad = (n - 1) / 2
for p in range(0, 55, 5): # percent of computing power of bad nodes
dist = binom(n, p / 100)
print(dist.cdf(max_bad), end='\t')
print("")
@marmistrz
marmistrz / pytest.log
Created August 11, 2017 10:51
Errors on Python3.6
==================================================================================================== FAILURES =====================================================================================================
____________________________________________________________________________________ TestDummyTask.test_dummy_task_computation ____________________________________________________________________________________
self = <test_dummy_task.TestDummyTask testMethod=test_dummy_task_computation>, mocks = (), error_msg = 'Computation timed out'
def test_dummy_task_computation(self, *mocks):
error_msg = runner.run_simulation(
num_computing_nodes=2, num_subtasks=3, timeout=420)
> self.assertIn(error_msg, [None, "Node exited with return code 0"])
E AssertionError: 'Computation timed out' not found in [None, 'Node exited with return code 0']
@marmistrz
marmistrz / pylint.subdir.log
Last active August 11, 2017 08:09
Pylint ran on all subdirectories, commit 438de66edbe00b7ae7e7284b51d91a4b90c7d213
************* Module apps.appsmanager
C: 1, 0: Missing module docstring (missing-docstring)
R: 11, 0: Too few public methods (0/2) (too-few-public-methods)
C: 26, 4: Missing method docstring (missing-docstring)
W: 30, 8: Using deprecated method readfp() (deprecated-method)
C: 44, 4: Missing method docstring (missing-docstring)
************* Module apps.core.task.verificator
C: 58, 0: Trailing newlines (trailing-newlines)
C: 1, 0: Missing module docstring (missing-docstring)
C: 8, 0: Invalid constant name "logger" (invalid-name)
@marmistrz
marmistrz / PKGBUILD
Created August 9, 2017 09:33
mypy hotfix PKGBUILD
# Maintainer: icasdri <icasdri at gmail dot com>
# Maintainer: hexchain <i@hexchain.org>
# Contributor: marmistrz <marmistrz.dev at zoho dot eu>
_pypi_name=mypy
pkgname=${_pypi_name}
pkgver=0.521
pkgrel=2
pkgdesc='Optional static typing for Python 2 and 3'
url="https://github.com/python/mypy"
@marmistrz
marmistrz / cargo test
Created July 25, 2017 08:07
nix cargo test
Doc-tests nix
running 19 tests
test src/sys/ioctl/mod.rs - sys::ioctl (line 126) ... FAILED
test src/sys/ioctl/mod.rs - sys::ioctl (line 183) ... FAILED
test src/sys/ioctl/mod.rs - sys::ioctl (line 171) ... FAILED
test src/pty.rs - pty::posix_openpt (line 87) ... FAILED
test src/sys/ioctl/mod.rs - sys::ioctl (line 220) ... FAILED
test src/sys/ioctl/mod.rs - sys::ioctl (line 56) ... FAILED
test src/sys/ioctl/mod.rs - sys::ioctl (line 67) ... FAILED
$ ./example2
getrandom request: 0x00007fe7a66b69a0 0x0000000000000018
getrandom request: 0x00007fff0556eeb0 0x00000000000009c0
getrandom request: 0x00007fff0556e740 0x00000000000009c0
*** stack smashing detected ***: python terminated
======= Backtrace: =========
/usr/lib/libc.so.6(+0x72bdd)[0x7fe7a6729bdd]
/usr/lib/libc.so.6(__fortify_fail+0x38)[0x7fe7a67b6158]
/usr/lib/libc.so.6(__fortify_fail+0x0)[0x7fe7a67b6120]
/usr/lib/python3.6/lib-dynload/_random.cpython-36m-x86_64-linux-gnu.so(+0x1285)[0x7fe7a4518285]
#!/usr/bin/env python
from math import sqrt
from sys import argv, exit
from os import getpid, system
from random import random
argc = len(argv)
if argc != 2:
print("Usage: ./pi.py num_steps")
#include <stdio.h>
#include <stdlib.h>
#include <sys/ptrace.h>
#include <sys/reg.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <unistd.h>
void wait_sigtrap() {