Skip to content

Instantly share code, notes, and snippets.

View igaozp's full-sized avatar
:shipit:
happy coding

igaozp igaozp

:shipit:
happy coding
View GitHub Profile
"" Source your .vimrc
"source ~/.vimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching.
set incsearch
" :actionlist可以查询所有命令
" 基本思路
" w 比如全屏、分屏
" g 跳转
" z 比如打开最近修改的文件那种了
" q 关闭标签
" e 运行/调试
" t 任务
set showmode
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Stream;

/**
@igaozp
igaozp / sqrt.go
Created January 14, 2018 05:42
牛顿法计算平方根
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := 1.0
for i := 0; i < 1000; i++ {
@igaozp
igaozp / Iterator.kt
Created December 25, 2017 10:10
Kotlin 自定义 Iterator
class DateRange(val start: MyDate, val end: MyDate) : Iterable<MyDate> {
override fun iterator(): Iterator<MyDate> = DateIterator(start, end)
}
class DateIterator(val start: MyDate, val end: MyDate) : Iterator<MyDate> {
var hasNext = start <= end
var next = if (hasNext) start else end
override fun hasNext(): Boolean = hasNext
@igaozp
igaozp / dec_to_hex.cpp
Created November 19, 2017 02:41
十进制转十六进制
#include <iostream>
#include <algorithm>
using namespace std;
void dec_to_hex(long long &dec) {
string hex;
if (dec == 0) {
hex = "0";
}
@igaozp
igaozp / hex_to_dec.cpp
Created November 19, 2017 02:19
十六进制转十进制
#include <iostream>
#include <cmath>
using namespace std;
void hex_to_dec(string &hex) {
long long dec = 0;
for (int i = hex.length() - 1; i >= 0; i--) {
int num = 0;
if (hex[i] >= '0' && hex[i] <= '9') {
@igaozp
igaozp / disk_info.cpp
Created November 18, 2017 04:57
读取磁盘信息
#include <windows.h>
#include <iostream.h>
#include <winioctl.h>
#include <string.h>
//关于Disk结构的定义
struct Disk
{
HANDLE handle;
DISK_GEOMETRY disk_info;
@igaozp
igaozp / process_read.cpp
Created November 18, 2017 04:54
进程通过读写内存共享数据
# include <windows.h>
# include <iostream>
int main(int argc, char* argv[])
{
HANDLE lhShareMemory;
char* lpcBuffer;
lhShareMemory = OpenFileMapping(FILE_MAP_READ, false, "mySharedMemory");
if (NULL == lhShareMemory)
@igaozp
igaozp / virtual_memory_allocation.cpp
Created November 18, 2017 04:51
虚拟内存分配
#include <windows.h>
#include <iostream>
void FillZero(LPVOID pBlock, DWORD dwSize)
{
_try
{
BYTE* arFill = (BYTE *)pBlock;
for (DWORD dwFill = 0; dwFill < dwSize; ++dwFill)
{
arFill[dwFill] = 0;