Skip to content

Instantly share code, notes, and snippets.

View jeremyfix's full-sized avatar

Jeremy Fix jeremyfix

View GitHub Profile
@jeremyfix
jeremyfix / PIT
Created September 29, 2024 07:22
Samsung galaxy A5 2017 partition tables and other informations
Entry Count: 30
Unknown 1: 1598902083
Unknown 2: 844251476
Unknown 3: 21324
Unknown 4: 14153
Unknown 5: 14392
Unknown 6: 48
Unknown 7: 0
Unknown 8: 0
@jeremyfix
jeremyfix / vtk-to-nc.py
Created September 17, 2024 15:39
VTK to NetCDF4 nc conversion
# coding: utf-8
import argparse
import logging
from netCDF4 import Dataset
import numpy as np
import vtk
from vtk.util import numpy_support
@jeremyfix
jeremyfix / Instructions for adb connection over wifi
Last active August 20, 2024 06:02
How to connect to your phone with ADB for pulling/pushing files
- [Phone] Activate the developper options
- [Phone] Activate adb over wifi
- [Phone] In Wifi debug menu, select "Pair with a code", note the IP and port that are opened
- [Computer] run `adb pair IP:PORT` and enter the pairing code ; on success, the phone will display the paired device
- [Computer] "connect" to the device with `adb connect IP:PORT`
- [Computer] you can now run you adb commands, like `adb shell` to navigate the file system for example and then `adb pull xxxx` to download a file given its path
@jeremyfix
jeremyfix / env.yml
Last active September 19, 2022 07:08
Experimentation of pytorch 1.12 gradient descent with complex tensors
name: torchcomplex
channels:
- pytorch
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- blas=1.0=mkl
- brotli=1.0.9=h5eee18b_7
- brotli-bin=1.0.9=h5eee18b_7
@jeremyfix
jeremyfix / test_stanford.py
Created April 10, 2022 21:02
Loading the semantic labels of the stanford 2D 3D S dataset
import pathlib
import PIL.Image as Image
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import json
# Code taken from utils.py on https://github.com/alexsax/2D-3D-Semantics
def get_index(color):
@jeremyfix
jeremyfix / binary.py
Created March 10, 2022 12:50
Writting/reading a binary file in python with string, ints and numpy arrays
# coding: utf-8
# External imports
import numpy as np
FIELD_WIDTHS = {
'int': 16
}
ENDIAN = 'big'
@jeremyfix
jeremyfix / gist:afbdae585afc42dd6e77c6d0d038dfd2
Created November 20, 2021 15:29
Transform a scanned colored 2 pages book into single pages gray
# The margins were on the right and bottom parts (hence the first rotation to ease margin removal)
convert -rotate 180 -crop +130+210 +repage -density 130 -rotate -90 -colorspace gray +repage source.pdf tmp.pdf && mutool poster -x 2 tmp.pdf target.pdf
@jeremyfix
jeremyfix / Installation
Last active March 3, 2025 09:29
Turtlebot2 on ROS Noetic Ubuntu 20.04
# Make the workspace
mkdir ~/catkin_ws
cd catkin_ws
mkdir -p src
catkin_make
cd src
# Clone the required repositories
git clone https://github.com/turtlebot/turtlebot.git
To run a jupyter lab with a specific token, just :
jupyter lab --NotebookApp.token='toto'
This is handfull to use a custom token , for example when running a batch of jupyter lab for students working remotely to which you just want to provide a token and not the quite complicated instance specific URL.
@jeremyfix
jeremyfix / gist:95bcbab6d11834638720462e430737a4
Created December 21, 2020 21:36
Preprocessing of wikisources
Given texts from wikisource, the raw one , with the markup, from here https://fr.wikisource.org/w/index.php?title=Fables_et_opuscules_p%C3%A9dagogiques&action=edit
and suppose the whole wiki text is copied in fenelon.txt , we can somehow get rid of the markup and so on with the following
cat fenelon.txt | sed '/^</d' | perl -pe 's|\[\[Auteur.*?\]\]||' | sed 's/\[\[//g' | sed 's/\]\]//g' | sed 's/==//g' | sed '/^$/d' | perl -pe 's|<ref>.*?</ref>||' | perl -pe 's|<ref>.*?</ref>||' | perl -pe 's|<sup>.*?</sup>||' | perl -pe 's|</.*?>||' | sed "s/\’/'/g" | sed 's/»/"/g' | sed 's/«/"/g' | perl -pe 's|\{\{.*?\}\}||' | sed 's/œ/oe/g' | sed 's/Œ/OE/g' > fenelon2.txt
there are still some markup though.