Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Gro-Tsen / 20190505.android-copy-firefox-profile
Created May 5, 2019 11:00
Possible steps under Android to copy Firefox profile to Firefox Nightly
## FIRST, install Firefox Nightly on Android. Then run it once and let it start.
## Then force stop it and clear its cache (but not further data).
## Then understand the following commands, adapt them, and use them
## (as root through adb).
# Get the original profile name:
cd /data/data/org.mozilla.firefox/files/mozilla
srcsalt="$(echo *.default)"
echo "$srcsalt"
@Gro-Tsen
Gro-Tsen / override.xml
Created May 15, 2019 13:23
Fix for DjVu files being detected as MIME type image/vnd.djvu instead of image/vnd.djvu+multipage
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<!-- Created on 2019-05-15 to fix a reappearance of this bug: -->
<!-- https://bugs.launchpad.net/ubuntu/+source/djvulibre/+bug/1778088 -->
<!-- (DjVu seen as image/vnd.djvu instead of image/vnd.djvu+multipage) -->
<!-- https://twitter.com/gro_tsen/status/1128645721614356480 -->
<!-- Run "update-mime-database ~/.local/share/mime" after creating this. -->
<!-- Use "xdg-mime query filetype some-file.djvu" to test. -->
<!-- - David A. Madore -->
<mime-type type="image/vnd.djvu+multipage">
// This code is in the Public Domain.
#include <stdint.h>
#include <string.h>
#include <assert.h>
void
serialize_be_16 (uint8_t b[2], uint16_t w)
{
for ( int i=0 ; i<2 ; i++ )
## Initial attempt:
ffmpeg -loop 1 -i /tmp/schumann-piano-concerto-III-97-to-104.png -i /tmp/schumann-piano-concerto-III-97-to-104.ogg -c:v libx264 -tune stillimage -c:a aac -b:a 192k -shortest /tmp/out.mp4
## Phone doesn't like YUV444 format, so let's try this:
ffmpeg -loop 1 -i /tmp/schumann-piano-concerto-III-97-to-104.png -i /tmp/schumann-piano-concerto-III-97-to-104.ogg -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest /tmp/out.mp4
## Still not happy. Change framerate, audio bitrate and scale, perhaps?
ffmpeg -r 25 -loop 1 -i /tmp/schumann-piano-concerto-III-97-to-104.png -i /tmp/schumann-piano-concerto-III-97-to-104.ogg -c:v libx264 -tune stillimage -ar 48000 -c:a aac -b:a 96k -vf scale=1280:260 -pix_fmt yuv420p -shortest /tmp/schumann-piano-concerto-III-97-to-104.mp4
## Apparently, Twitter also worries about the aspect ratio:
## The vector space in which everything will happen:
V = QQ^8
## The simple roots (and smallest root alpha0) of E_8 under the usual “even”
## coordinate system:
alpha1 = V((1,-1,-1,-1,-1,-1,-1,1))/2
alpha2 = V((1,1,0,0,0,0,0,0))
alpha3 = V((-1,1,0,0,0,0,0,0))
alpha4 = V((0,-1,1,0,0,0,0,0))
alpha5 = V((0,0,-1,1,0,0,0,0))
## Find numbers n which have a good score sigma(n)/(n*log(log(n))):
## see https://twitter.com/johncarlosbaez/status/1149700802371608576
## Prime factorization of 2520:
bootstrap = {2: 3, 3: 2, 5: 1, 7: 1}
## Compute the score sigma(n)/(n*log(log(n))) from the prime factorization:
def goodness(d):
n = prod([p^(d[p]) for p in d.keys()])
sig = prod([(p^(d[p]+1)-1)/(p-1) for p in d.keys()])
  • Sans abonnement 23.40€/h ; location « mise en pause » à 7.80€/h

  • Tarif journée (≥4h) existe peut-être, introuvable sur le site

  • Renault Zoe (23.40€/h) ou Twizy (17.40€/h)

  • Dépôt de garantie (500€) ; état des lieux

double
uniform (void)
// Return a uniformly distributed random variable between 0 and 1.
{
#define ENTROPY_PER_RAND 31
#if RAND_MAX != (1<<ENTROPY_PER_RAND)-1
#error Please fix ENTROPY_PER_RAND
#endif
int entropy = 0;
double val = 0.5;
#### Start gap with enough memory (e.g., "gap -o 8g" for 8GB) to run this.
## The MOG cells are labeled top to bottom and left to right:
## so the leftmost column is 1,2,3,4 and the rightmost is 21,22,23,24,
## whereas the top line is 1,5,9,13,17,21.
## Generators of the Mathieu group M_24:
rotate_blocks := (1,9,17)(2,10,18)(3,11,19)(4,12,20)(5,13,21)(6,14,22)(7,15,23)(8,16,24);
flip_blocks12 := (1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16);
omega_cols := (2,3,4)(6,7,8)(10,11,12)(14,15,16)(18,19,20)(22,23,24);
for i in $(seq 0 9) ; do convert -size 960x720 'xc:gray' -font 'FreeSans' -pointsize 200 -gravity Center -annotate 0 $i frame${i}.png ; done
for i in $(seq 0 9) ; do echo "file frame${i}.png" ; echo "duration 6.000" ; done > video.script
sox -n -r 48000 -c 2 -t flac silence.flac trim 0.0 60.0
ffmpeg -f concat -i video.script -i silence.flac -c:v libvpx -crf 12 -pix_fmt yuv420p -c:a libopus -b:a 192k test.webm