Skip to content

Instantly share code, notes, and snippets.

View orca-zhang's full-sized avatar
🎖️
<coolcode />

orca-zhang

🎖️
<coolcode />
  • Shanghai, China & Singapore
View GitHub Profile
@orca-zhang
orca-zhang / base64.java
Last active May 29, 2019 02:57
simple base64 decode snippet
import java.util.Arrays;
public class main {
private static byte base64_reverse_table[] = {
-2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -2, -2, -1, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, -2, -2, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, -2, -2, -2,
-2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, -2,
@orca-zhang
orca-zhang / to_unix.go
Created March 19, 2019 13:19
Fast conversion from date to Unix Timestamp
func toUnix(year, month, day, hour, min, sec int) int64 {
if month < 1 || month > 12 {
return -1
}
leap := 0
if (year%4 == 0 && (year%100 != 0 || year%400 == 0)) && month >= 3 {
leap = 1 // February 29
}
@orca-zhang
orca-zhang / wildcards.go
Last active May 28, 2019 10:19
case sensitive wildcards match function
/*
MIT License
Copyright (c) 2010-2019 <http://ez8.co> <orca.zhang@yahoo.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@orca-zhang
orca-zhang / wildcards.c
Last active February 28, 2022 08:40
case sensitive wildcards match function
/*
MIT License
Copyright (c) 2010-2017 <http://ez8.co> <orca.zhang@yahoo.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@orca-zhang
orca-zhang / memhex.c
Created January 25, 2018 14:42
A small tool used to inspect memory of remote active process under Linux without any side-effect (MAYBE, as tested).
/*
MIT License
Copyright (c) 2010-2017 <http://ez8.co> <orca.zhang@yahoo.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is