Skip to content

Instantly share code, notes, and snippets.

View Muqsit's full-sized avatar
🇵🇸
I am a beacon of hope

Muqsit Rayyan Muqsit

🇵🇸
I am a beacon of hope
View GitHub Profile
@Muqsit
Muqsit / RadioButtonVertical_Ant.js
Created August 29, 2022 06:55
RadioButtonVertical_Ant.js
import { Radio } from "antd";
import React from "react";
import * as css from "./RadioButtonVertical.scss";
import 'antd/lib/radio/style/index.css';
export const RadioButtonVertical_Ant = (props) => {
const { field, item, name } = props;
const { value, onChange } = field;
<?php
declare(strict_types=1);
/**
* @name InvMenuListenerTest
* @main muqsit\imtest\InvMenuListenerTest
* @version 0.0.1
* @api 3.0.0
*/
@Muqsit
Muqsit / main.rs
Created January 5, 2022 21:46
Converting head layer from minecraft skin data to a standard image format
use image::*;
use image::imageops::FilterType;
use std::result::Result;
// Takes a byte array of skin data and returns the face layer encoded in a given
// standard image format. The `width` and `height` here are the widths and heights
// of the output image (not the input skin).
fn skin_to_image_data(bytes: &Vec<u8>, width: u32, height: u32, format: ImageFormat) -> Result<Vec<u8>, &'static str>{
let blocks = skin_get_block_length(bytes.len())?;
@Muqsit
Muqsit / orientation_sampler.py
Created October 3, 2021 02:09
Simple outlier removal sampler for the BNO055 sensor (or any distance sensor for that matter)
import math
'''
Divides the sample into two clusters - left and right, where the left cluster
contains all values > mean(sample) and the right cluster contains all other
values.
The cluster with most number of values wins! Returns the winning cluster's mean.
If the cluster's max deviation from mean (i.e., min(cluster) - mean(sample)) is
@Muqsit
Muqsit / setting-up-raspberry-pi-ttl.md
Last active September 28, 2021 04:27
Setting up Raspberry Pi (4) to access via TTL

Steps

  1. Install Raspberry Pi OS image and "Raspberry Pi Imager" software from https://www.raspberrypi.org/software/
  2. Flash OS image via Raspberry Pi Imager
  3. Open E:\config.txt (assuming E:\ is the drive the image was flashed on to)
  4. Add enable_uart=1 under the [all] section (the section is most likely at the end of file)
  5. Add dtoverlay=disable-bt under the [all] section
  6. Insert SD card in Raspberry Pi
  7. Connect to device via serial line at speed=115200

Precautions

@Muqsit
Muqsit / btree.php
Last active April 21, 2021 22:23
B-Tree in PHP test implementation
<?php
declare(strict_types=1);
final class Node{
public static function buildTree(int $size, ?Node $node = null) : self{
$node ??= new Node();
$node->entries[0] = new Node();
$node->entries[1] = new Node();
<?php
declare(strict_types=1);
/**
* @name InventoryTransactionEventTest
* @main muqsit\testing\InventoryTransactionEventTest
* @api 4.0.0
* @version 0.0.1
*/
@Muqsit
Muqsit / OnlinePlayerIterator.php
Last active October 4, 2020 09:38
OnlinePlayerIterator.php
<?php
declare(strict_types=1);
final class Player{
/** @var int */
public $id;
/** @var bool */
<?php
declare(strict_types=1);
$db = $argv[1];
$host = $argv[2];
$user = $argv[3];
$pwd = $argv[4];
$mysql = new mysqli($host, $user, $pwd, $db);
@Muqsit
Muqsit / pc-pe-mapping.json
Created April 17, 2020 14:58
PC -> PE block:meta mapping
{
"3:2": "243:0",
"29:2": "29:3",
"29:3": "29:2",
"29:4": "29:5",
"29:5": "29:4",
"31:0": "32:0",
"33:2": "33:3",
"33:3": "33:2",
"33:4": "33:5",