This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <queue> | |
#include <unordered_map> | |
using namespace std; | |
// A Tree node | |
struct Node | |
{ | |
char ch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstring> | |
#include <iostream> | |
#include <stdexcept> | |
using namespace std; | |
class Fraction { | |
int numerator; | |
int denominator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.pwxcoo.github.utils; | |
import javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.PBEKeySpec; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.SecureRandom; | |
import java.security.spec.InvalidKeySpecException; | |
import java.util.Arrays; | |
import java.util.Base64; | |
import java.util.Random; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
栈和局部变量操作 | |
将常量压入栈的指令 | |
aconst_null 将null对象引用压入栈 | |
iconst_m1 将int类型常量-1压入栈 | |
iconst_0 将int类型常量0压入栈 | |
iconst_1 将int类型常量1压入栈 | |
iconst_2 将int类型常量2压入栈 | |
iconst_3 将int类型常量3压入栈 | |
iconst_4 将int类型常量4压入栈 | |
iconst_5 将int类型常量5压入栈 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check(frame, p): | |
n = len(p) - 1 | |
fcs = frame[0: n] | |
for i in range(n, len(frame)): | |
fcs += frame[i] | |
fcs = bin(int(fcs, 2))[2:] | |
if (len(fcs) < len(p)): | |
continue | |
fcs = bin(int(fcs, 2) ^ int(p, 2))[2:] | |
while len(fcs) < n: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://joonro.github.io/blog/posts/powershell-customizations.html | |
Import-Module PSReadLine | |
# Oh-My-Posh https://github.com/pecigonzalo/Oh-My-Posh | |
Import-Module "Oh-My-Posh" -DisableNameChecking -NoClobber | |
Set-PSReadLineOption -HistoryNoDuplicates | |
Set-PSReadLineOption -HistorySearchCursorMovesToEnd | |
Set-PSReadLineOption -HistorySaveStyle SaveIncrementally | |
Set-PSReadLineOption -MaximumHistoryCount 4000 | |
# history substring search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://askubuntu.com/questions/970988/two-finger-scrolling-not-working-for-ubuntu-17-10 | |
sudo modprobe -r psmouse | |
sudo modprobe psmouse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Time: O(n) | |
* Space: O(1) | |
* 1. find list if exists cycle. | |
* 2. 0 -> a(cycle s) -> b(cycle met) -> c(cycle s(e)) | |
* slow = a + b + (b + c)n1, fast = a + b + (b + c)n2. | |
* slow * 2 = fast | |
* 2a + 2b + 2*n1*(b + c) = a + b + n2*(b + c) => a = (n2 - 2*n1) * (b + c) - b | |
* After meeting, so one start going from head and meanwhile slow start going, they will meet at cycle begin. | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.atomic.AtomicInteger; | |
public class AtomicIntegerExample { | |
private AtomicInteger sycValue = new AtomicInteger(0); | |
private static final int MAX_SYC_VALUE = 3 * 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -rf ~/.cache/ibus/libpinyin | |
ibus restart |
NewerOlder