Skip to content

Instantly share code, notes, and snippets.

@arshednabeel
arshednabeel / vicsek.py
Last active April 25, 2024 02:19
A minimal implementation of the Vicsek model in ~50 lines of code
import numpy as np
from tqdm import trange
def get_neighbour_matrix(x, L, R):
dx = np.subtract.outer(x[:, 0], x[:, 0])
dy = np.subtract.outer(x[:, 1], x[:, 1])
dx[dx > (L / 2) ** 2] -= (L / 2) ** 2
dy[dy > (L / 2) ** 2] -= (L / 2) ** 2
pair_dist = dx ** 2 + dy ** 2

Unpack Android system.new.dat.br

pacman -S brotli p7zip
curl -L -o /usr/local/bin/sdat2img.py https://github.com/xpirt/sdat2img/raw/master/sdat2img.py && chmod +x sdat2img.py

brotli -d system.new.dat.br
sdat2img.py system.transfer.list system.new.dat system.img
7z -y -bsp0 -bso0 x system.img
@pangyuteng
pangyuteng / Dockerfile
Last active April 25, 2024 02:16
docker miniconda ubuntu
#
# ref https://github.com/tebeka/pythonwise/blob/master/docker-miniconda/Dockerfile
#
# miniconda vers: http://repo.continuum.io/miniconda
# sample variations:
# Miniconda3-latest-Linux-armv7l.sh
# Miniconda3-latest-Linux-x86_64.sh
# Miniconda3-py38_4.10.3-Linux-x86_64.sh
# Miniconda3-py37_4.10.3-Linux-x86_64.sh
#
@Bill-tran
Bill-tran / how-to-install-openssl-1.1.1-on-centos-7.md
Created September 7, 2021 09:22
How to install openssl 1.1.1 on CentOS 7

How To Install OpenSSL 1.1.1 on CentOS 7

This tutorial goes through how to install openssl 1.1.1 on CentOS 7, since the yum repo only installs up to openssl 1.0.

Requirements

Upgrade the system

yum -y update
@Seshiria
Seshiria / readme.md
Created February 20, 2022 14:45
android system解包打包流程
@0xdevalias
0xdevalias / reverse-engineering-webpack-apps.md
Last active April 25, 2024 02:11
Some notes and techniques for reverse engineering Webpack (and a little bit about React/Vue) apps
@wareya
wareya / spi_recorder.ino
Last active April 25, 2024 02:11
long SPI message recorder - rasberry pi pico (rp2040), arduino IDE .ino file (C++)
// wiring example for ripping a PMW3360 SROM: https://i.imgur.com/EspAlvz.jpeg
// set the board to 240mhz or higher for best results (WARNING: higher than 240mhz only works with USB if you overvolt the MCU)
// this implements reading SPI mode 3. if you want a different mode, you need to edit these two lines:
// uint32_t clockval = (1 << pin_clock);
// if (newclock && !clockval && buff_i < buffsize)
#include <pico/stdlib.h>
#define buffsize 50000
@eminetto
eminetto / rfc.md
Created May 15, 2021 15:42
Template de RFC

Título

Descrição do problema

Devemos explicar o problema claramente e identificar detalhes adicionais que a equipe precise saber. Devemos aqui descrever o contexto, o que foi feito até agora e o estado atual.

A descrição também serve como uma trilha à qual podemos voltar no futuro para entender o raciocínio que tínhamos na época e ver quais restrições e requisitos mudaram.

Possíveis abordagens

@michabbb
michabbb / PestPHP architecture testing.php
Created April 21, 2024 20:22
PestPHP architecture testing
<?php
/** @see https://twitter.com/garyclarketech/status/1781605977101644015/photo/1 **/
test('debugs are removed')
->expect(['dd', 'dump', 'var_dump'])
->not->toBeUsed();
test('CommandInterface is implemented where is should be')
->expect('App\Command')
@markthiessen
markthiessen / getWeeksInMonth.js
Last active April 25, 2024 02:05
JavaScript - get weeks in a month as array of start and end days
//note: month is 0 based, just like Dates in js
function getWeeksInMonth(year, month) {
const weeks = [],
firstDate = new Date(year, month, 1),
lastDate = new Date(year, month + 1, 0),
numDays = lastDate.getDate();
let dayOfWeekCounter = firstDate.getDay();
for (let date = 1; date <= numDays; date++) {