Skip to content

Instantly share code, notes, and snippets.

View sonald's full-sized avatar
🎯
Focusing

Sian Cao sonald

🎯
Focusing
View GitHub Profile
@sonald
sonald / wsl2-network.ps1
Created May 24, 2021 08:33 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@sonald
sonald / wm.md
Last active August 22, 2017 03:38
wm

窗口管理器(Window Manager)

这篇文章可以看成是一个备忘录,分别从两个角度来描述了有关窗口管理器的一些信息。首先是从用户的角度来看,接着从技术的角度来探讨有关窗口管理器的一些问题。

什么是窗口管理器

  • 是X11/Linux上的一个概念,windows似乎没有这种东西。技术上说它是一个X11的客户端程序,没有走后门,通过标准的X11技术来管理顶层窗口的请求、大小、位置、层次关系等。并且根据口味、窗口类型等信息决定是不是要给顶层窗口提供边框,标题栏、状态栏等界面元素。不同的窗口管理器外表上看可能千差万别。
  • 所以窗口管理器是 一个X11客户端程序,它控制其他图形程序的外观和行为方式:边框、标题栏、大小、布局等以及允许对窗口进行调整大小、位置的等操作(通过鼠标或快捷键)。
  • 窗口管理器有几种分类方式: 按照管理窗口的方式:
From e5a8564a214e32e9c83478547ede7f79ac412cf7 Mon Sep 17 00:00:00 2001
From: Sian Cao <yinshuiboy@gmail.com>
Date: Mon, 28 Nov 2016 11:10:32 +0800
Subject: [PATCH] Support actors(blur) to be always redrawn
Blur actors needs to be redrawn every frame which obey clutter's redraw
policy. So we need a way to bypass it.
---
clutter/clutter-stage.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
clutter/clutter-stage.h | 10 ++++++++-
@sonald
sonald / Makefile
Created March 13, 2015 06:15
bootsect and small kernel
all: r
r: kernel.bin
qemu-system-x86_64 -fda $< -monitor stdio
kernel.bin: kernel.asm
nasm -f bin -o $@ $<
@sonald
sonald / type-punning
Created March 5, 2015 03:51
type-punning ans strict aliasing
#include <stdio.h>
#include <stdlib.h>
/**
* gcc -O2 will cause `tail = (Node*)&list;` to be optimized out, will give list === null
*/
typedef struct Node_ {
struct Node_* next;
int val;
} Node;
@sonald
sonald / parser.y
Created November 4, 2014 05:09
cool parser
/*
* cool.y
* Parser definition for the COOL language.
*
*/
%{
#include <iostream>
#include "cool-tree.h"
#include "stringtab.h"
#include "utilities.h"
@sonald
sonald / gist:367efbdc0becee379b81
Last active August 29, 2015 14:08
leetcode: merge tow sorted lists
// https://oj.leetcode.com/problems/merge-two-sorted-lists/
ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) {
ListNode dummy {0};
ListNode** tail = &dummy.next;
while (l1 && l2) {
ListNode* tmp = nullptr;
if (l1->val < l2->val) {
tmp = l1; l1 = l1->next;
} else {
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@sonald
sonald / dabblet.css
Created May 7, 2013 08:37
Circular Tooltip (SO)
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */
@sonald
sonald / dabblet.css
Created May 7, 2013 08:34
Circular Tooltip (SO)
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */