Skip to content

Instantly share code, notes, and snippets.

View bugparty's full-sized avatar
🎯
Focusing

Bowen Han bugparty

🎯
Focusing
View GitHub Profile
@bugparty
bugparty / room_bandwith_test_steamdeck.cpp
Created June 16, 2025 03:38
steamdeck room hip gpu bandwidth test
#include <hip/hip_runtime.h>
#include <iostream>
#include <chrono>
#include <hip/hip_fp16.h>
#include "utils.hpp"
#define N (2047 * 1024 * 1024) // MB
#define THREADS_PER_BLOCK 256
__global__ void read_kernel(const int* __restrict__ data, long long* __restrict__ sum_out, size_t count) {
size_t idx = threadIdx.x + blockIdx.x * blockDim.x;
@bugparty
bugparty / bcache-status
Last active February 17, 2025 23:59 — forked from damoxc/bcache-status
#!/usr/bin/env python3
#
# Dumb script to dump (some) of bcache status
# Copyright 2013 Darrick J. Wong. All rights reserved.
#
# This file is part of Bcache. Bcache is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@bugparty
bugparty / ros1_kobuki.sh
Last active May 22, 2024 05:41
install ros1 and kobuki
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Function to install ROS Noetic
install_ros() {
echo "Setting up sources.list for ROS Noetic"
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
@bugparty
bugparty / kobuki_install.sh
Created May 22, 2024 04:17
kobuki install script
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Install ROS Noetic Kobuki core packages
echo "Installing ROS Noetic Kobuki core packages"
sudo apt-get install -y ros-noetic-kobuki-core
# Install additional dependencies
@bugparty
bugparty / ros1_install.sh
Created May 22, 2024 04:05
script to install ros1
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Setup sources.list
echo "Setting up sources.list"
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# Setup your keys
@bugparty
bugparty / avx_mathfun.h
Created February 16, 2024 16:20
comment version of avx2 log
/*
AVX implementation of sin, cos, sincos, exp and log
Based on "sse_mathfun.h", by Julien Pommier
http://gruntthepeon.free.fr/ssemath/
Copyright (C) 2012 Giovanni Garberoglio
Interdisciplinary Laboratory for Computational Science (LISC)
Fondazione Bruno Kessler and University of Trento
via Sommarive, 18
class Solution {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
if(nums1.size() == 0 || nums2.size() == 0 || (nums1.size() > 1 && *nums1.begin() == *nums1.rbegin()) ||(nums2.size() > 1 && *nums2.begin() == *nums2.rbegin())){
vector<int> &ref = (nums1.size() > 0 ? nums1 : nums2);
if(nums1.size() > 0 && nums2.size() > 0){
if (*nums1.begin() == *nums1.rbegin()){
ref = nums2;
@bugparty
bugparty / install.sh
Created July 29, 2019 15:15
install docker on ubuntu 18.04
#!/bin/bash
apt -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
apt update && apt -y install docker-ce docker-compose
@bugparty
bugparty / Attack.sol
Created February 2, 2018 21:42 — forked from anonymous/Attack.sol
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.17-nightly.2017.9.11+commit.fbe24da1.js&optimize=false&gist=
contract AbstractVault {
address[] public authorizedUsers;
address public owner;
address public withdrawObserver;
address public additionalAuthorizedContract;
address public proposedAAA;
uint public lastUpdated;
bool[] public votes;
address [] public observerHistory;
modifier onlyAuthorized() {
@bugparty
bugparty / ExceptionWriter.java
Created June 29, 2017 07:44
Write Exception object to string
import android.support.annotation.NonNull;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;