Skip to content

Instantly share code, notes, and snippets.

View vfishv's full-sized avatar

Quentin vfishv

  • Earth
View GitHub Profile
@cloudwu
cloudwu / rainwater.c
Last active May 26, 2024 13:15
Trapping rain water
#include <stdio.h>
static void
minmax(int height[], int n, int *min, int *max) {
int i;
*min = *max = height[0];
for (i=1;i<n;i++) {
if (height[i] < *min)
*min = height[i];
else if (height[i] > *max)
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<LinearLayout
@kurtdekker
kurtdekker / AddRingOfSphereColliders.cs
Last active February 6, 2025 11:52
Creates a torus of SphereColliders to allow a torus with a Rigidbody in Unity3D
using UnityEngine;
using UnityEditor;
// @kurtdekker - easy cheesy add sphere colliders in a circle (for a torus)
// see notes below for how to make it go around a different axis
public class AddRingOfSphereColliders : EditorWindow
{
int count = 24;
float largeRadius = 2.0f;
@hibetterheyj
hibetterheyj / all_pdf_dl.py
Last active September 6, 2025 07:06
Download all pdf files from a website
import os
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import argparse
#%% Example
# one pdf
# python all_pdf_dl.py -l https://memento.epfl.ch/academic-calendar/ --save-here
# many pdfs
@gtf35
gtf35 / (Android)UDPReceiverNetwork.kt
Created January 6, 2021 07:12
通过 UDP 广播局域网自动发现 Android 客户端 IP / Auto find android device ip by UDP broadcast
// Receive desptop`s udp broadcast package on Android, let Android app known desktop device`s ip
package top.gtf35.nekosdk.network
import kotlinx.coroutines.*
import top.gtf35.nekosdk.utils.LogUtil
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.DatagramPacket
import java.net.DatagramSocket
import java.net.InetAddress
@ZhangMenghe
ZhangMenghe / readme.md
Last active April 2, 2023 14:53
Protobuf for Android and Android NDK

Using

  • Ubuntu 18.02
  • Android NDK 20.0.5594570
  • Protobuf v3.12.2
  • Language C++ / Java

Use clang:

S1: Generate standalone toolchain

@RikkaW
RikkaW / gist:be3fe4178903702c54ec73b2fc1187fe
Last active July 14, 2025 07:09
show window in app_process (impossible to work from Android 14 QPR 3 or Android 15, as addView requires the calling process an Android app process)
token = new Binder();
try {
Context _context = android.app.ActivityThread.systemMain().getSystemContext();
final Context context = new ContextWrapper(_context) {
@Override
public Object getSystemService(String name) {
if (Context.WINDOW_SERVICE.equals(name)) {
WindowManager wm = (WindowManager) super.getSystemService(name);
if (wm != null) {
((android.view.WindowManagerImpl) wm).setDefaultToken(token);
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active December 8, 2025 09:47
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@wilmarvh
wilmarvh / git checkout-all-branches.sh
Last active October 1, 2025 06:54
git checkout-all-branches
#!/bin/bash
#Whenever you clone a repo, you do not clone all of its branches by default.
#If you wish to do so, use the following script:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master | grep -v main `; do
git branch --track ${branch#remotes/origin/} $branch
done
@oldmud0
oldmud0 / gh-pages-old.md
Created May 1, 2018 22:16
Old GitHub Pages IP addresses for A records

On May 1, 2018, GitHub changed the suggested IP addresses to put on the A records for domains that use GitHub Pages. The new ones now support HTTPS for custom domains, but the old ones did not. Here are the old ones for historical purposes:

  • 192.30.252.153
  • 192.30.252.154

Here are the new ones:

  • 185.199.108.153
  • 185.199.109.153
  • 185.199.110.153