Skip to content

Instantly share code, notes, and snippets.

View AidySun's full-sized avatar

AidySun

  • Beijing
View GitHub Profile
@AidySun
AidySun / cheat_sheet.txt
Created July 12, 2021 09:14
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ImageManipulationExample {
static String PATH = "C:/Users/tiago/Pictures/";
static String SOURCE1 = "image1";
static String SOURCE2 = "image2";
@AidySun
AidySun / check_endian.cpp
Created May 23, 2019 08:50
Check System is Big-Endian or Little-endian
void check_endian() {
union {
short s;
char c[sizeof(short)];
} un;
un.s = 0x0102;
if (sizeof(short) == 2) {
if (un.c[0] == 1 && un.c[1] == 2) {
printf("Big-endian\n");
@AidySun
AidySun / error_code_of_adobe_extension_manager_cmd_exmancmd.md
Created May 7, 2019 02:27
Error codes of ExManCmd - Adobe Extension Manager Command Line
@AidySun
AidySun / OpenWithSublimeText3.bat
Created March 7, 2019 08:27 — forked from jackielii/OpenWithSublimeText3.bat
Add "Open with Sublime Text 3" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@AidySun
AidySun / VNC of macOS Mojave (10.14).md
Created March 7, 2019 06:13
enable built-in VNC control of macOS Mojave (10.14) when remoting desktop using VNC client

After updating to macOS 10.14 Mojave, it stops at the login screen when remoting to it from PC using VNC clients. The username is shown but not the password box. After searching, we know that it is caused by the changes in macOS 10.14. Remote screens have view-only access.

To make the remoting desktop work just using Apple's built-in VNC server as before:

  1. In Finder, navigate to `/System/Library/CoreServices/RemoteManagement'
  2. Right click on AppleVNCServer.bundle and select Show Package Contents.
  3. Navigate into Contents/MacOS.
  4. Open System Preferences -> Security & Privacy -> Privacy -> Accessibility
@AidySun
AidySun / .profile
Created March 1, 2019 07:37
How about this safe rm function to prevent "rm -rf /" on macOS (and Linux)?
# ~/.profile
function saferm() {
echo rm "$@"
echo ""
read -p "* execute rm (y/n)? : " yesorno
if [ $yesorno == "y" ]; then
/bin/rm "$@"
fi
@AidySun
AidySun / centered.md
Created February 26, 2019 09:23 — forked from ProjectCleverWeb/centered.md
Example of how to do centered text and images in Githb Flavored Markdown
@AidySun
AidySun / BinaryHeap.cpp
Created February 15, 2019 09:51
Array based binary heap/max heap/min heap. 基于数组的大顶堆/小顶堆。C++
#include <iostream>
using namespace std;
template<typename T>
class BinaryHeap {
private:
static const int DEFAULT_SIZE = 32;
public:
BinaryHeap() {
@AidySun
AidySun / exercise-web-crawler.go
Created June 26, 2018 07:58
A Tour of Go - Exercise: Web Crawler
package main
import (
"fmt"
"time"
"sync"
//"runtime"
)
// ******************* Fetch History ****************************