Required tools for playing around with memory:
hexdumpobjdumpreadelfxxdgcore
| #include <stddef.h> | |
| /** | |
| * return length of valid string which has '\0' or 0 as terminated | |
| */ | |
| size_t | |
| str_len( const char *str) | |
| { | |
| size_t i; | |
| for( i = 0; str[i] != '\0'; i++); | |
| return i; |
| #include <stdio.h> | |
| void clear_stdin_buffer() { | |
| char ch; | |
| while( (ch = getchar()) != '\n' && ch != EOF ); | |
| } |
| Byobu Commands | |
| ============== | |
| byobu Screen manager | |
| Level 0 Commands (Quick Start) | |
| ------------------------------ | |
| <F2> Create a new window |
https://askubuntu.com/questions/57620/getting-an-authentication-token-manipulation-error-when-trying-to-change-my-us https://blog.csdn.net/prince_jun/article/details/22507421
| int read_int() { | |
| char c = getchar_unlocked(); | |
| while(c<'0' || c>'9') c = getchar_unlocked(); | |
| int ret = 0; | |
| while(c>='0' && c<='9') { | |
| ret = 10 * ret + c - 48; | |
| c = getchar_unlocked(); | |
| } | |
| return ret; | |
| } |
| /* https://bugdivine.blogspot.com/p/fast-input-reader-in-cc.html */ | |
| #include <stdio.h> | |
| int fastRead_int() { | |
| register int c = getchar_unlocked(); | |
| int x; | |
| x = 0; | |
| int neg = 0; | |
| for(; ((c<48 || c>57) && c != '-'); c = getchar_unlocked()); | |
| if(c=='-') { |
| #!/bin/sh | |
| # Partly copy from https://tip.golang.org/misc/git/pre-commit | |
| # Copyright 2012 The Go Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style | |
| # license that can be found in the LICENSE file. | |
| # git gofmt pre-commit hook | |
| # | |
| # To use, store as .git/hooks/pre-commit inside your repository and make sure | |
| # it has execute permissions. |
| #!/bin/sh | |
| # Partly copy from https://tip.golang.org/misc/git/pre-commit | |
| # Copyright 2012 The Go Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style | |
| # license that can be found in the LICENSE file. | |
| # git gofmt pre-commit hook | |
| # | |
| # To use, store as .git/hooks/pre-commit inside your repository and make sure | |
| # it has execute permissions. |
08/16/17 by Sergey Grebenshchikov
This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.
GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.