Skip to content

Instantly share code, notes, and snippets.

@yisiper
yisiper / electrumsv.dockerfile
Created August 21, 2023 12:50
Electrumsv 1.3 dockerfile
FROM python:3.9.17-slim-bullseye as base
RUN set -x; apt-get update && apt-get upgrade -y --no-install-recommends
FROM base as compile-image
RUN apt-get install -y build-essential --no-install-recommends && \
apt-get install -y libgl1 libqt5gui5 libusb-dev libusb-1.0-0-dev libhidapi-dev python3-hidapi python3-hid \
libudev-dev libgudev-1.0-0 libudev1 python3-pyudev \
git \
&& pip install --upgrade pip \
&& apt-get autoremove && apt-get autoclean && rm -rf /var/lib/apt/lists/*
@yisiper
yisiper / evolution.sh
Created March 3, 2021 09:09
disable evolution mail program
#!/bin/bash
## improved version of the script at https://askubuntu.com/a/1068932
##
## Disables the Evolution mail program's services by moving the services files
## to another directory.
##
## This must be run as root.
##
#!/bin/sh
# Copyright (C) 2016 The Linux Containers Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
// extracted from https://github.com/shendykurnia/ajaib/blob/master/index.html
// runnable on nodejs
// should be able to optimize more, because slower than php version
var zero_pad = function(n,N) {
var string = n + '';
var num_zeros = N - (string).length;
for(var j = 0;j < num_zeros;j++) {
string = '0' + string;
}
@yisiper
yisiper / gist:b381a4a22c3d422aab8d
Created April 16, 2015 08:30
math combinatorics
<?php
/*
There are 299 numbers that contain 14 between 1 to 10,000 (not 300, because 1414 will be counted as 1)
How many numbers contain 14 between 1 to 10,000,000 ?
How many numbers contain 14 between 1 to 10,000,000,000 ?
ref:
https://www.mathsisfun.com/combinatorics/combinations-permutations.html
http://stackoverflow.com/questions/28182960/counting-same-containt-number-from-range-number-without-loop-in-ruby
http://math.stackexchange.com/questions/924399/how-many-integers-between-1-and-10n-contain-14au-cs244b/