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 December 22, 2024 14: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 October 2, 2024 14:10
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);
@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
@robjperez
robjperez / test.c
Last active January 12, 2022 11:46
scale a nv21 frame
int ystride = width;
int uvstride = ((width + 1) / 2) * 2;
uint8_t* yplane = (uint8_t *)cameraFrame;
uint8_t * uvplane = (uint8_t *)cameraFrame + (width * height);
uint8_t *newy = (uint8_t*)malloc(sizeof(uint8_t) * width * height);
uint8_t *newu = (uint8_t*)malloc(sizeof(uint8_t) * width * height / 4);
uint8_t *newv = (uint8_t*)malloc(sizeof(uint8_t) * width * height / 4);
int newuvstride = (width +1 ) / 2;
@rafaelstz
rafaelstz / get.js
Last active October 6, 2023 14:35
AJAX GET and POST with pure Javascript
// Exemplo de requisição GET
var ajax = new XMLHttpRequest();
// Seta tipo de requisição e URL com os parâmetros
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true);
// Envia a requisição
ajax.send();
// Cria um evento para receber o retorno.