Skip to content

Instantly share code, notes, and snippets.

View yinyue200's full-sized avatar

Yue Yin yinyue200

View GitHub Profile
@tommai78101
tommai78101 / unicode.c
Last active June 4, 2024 20:41
UTF-8 to UTF-16 one-way conversion, written in C
#include <stdio.h>
#include <stdlib.h>
#include <uchar.h>
#include <locale.h>
#define __STD_UTF_16__
//Pointer arrays must always include the array size, because pointers do not know about the size of the supposed array size.
void utf8_to_utf16(unsigned char* const utf8_str, int utf8_str_size, char16_t* utf16_str_output, int utf16_str_output_size) {
//First, grab the first byte of the UTF-8 string
@Snegovikufa
Snegovikufa / app.py
Created February 8, 2018 08:16
Extracts dlls from libmonodroid_bundle_app.so
from elftools.elf.elffile import ELFFile
from zipfile import ZipFile
import gzip, string
from io import StringIO, BytesIO
data = open('libmonodroid_bundle_app.so', "rb")
elffile = ELFFile(data)
section = elffile.get_section_by_name('.dynsym')
data.seek(0)
data_read = data.read()
@wojteklu
wojteklu / clean_code.md
Last active July 19, 2024 11:49
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@rudyryk
rudyryk / ImageMeter.cs
Last active October 6, 2023 11:32
C# — Get image size by name in Xamarin.Forms for iOS and Android platforms
//
// ImageMeter.cs
// Created by Alexey Kinev on 9 May 2015.
//
// No Rights Reserved
// http://creativecommons.org/publicdomain/zero/1.0/
//
// Get image size by name in Xamarin.Forms for iOS and Android platforms.
//
using System;
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@edokeh
edokeh / index.js
Last active July 16, 2024 01:43
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@dabrahams
dabrahams / private_access.cpp
Created December 28, 2011 17:50
Accessing Private Data
#include <iostream>
// This is a rewrite and analysis of the technique in this article:
// http://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html
// ------- Framework -------
// The little library required to work this magic
// Generate a static data member of type Tag::type in which to store
// the address of a private member. It is crucial that Tag does not