gnu

Multi-line, double quoted string triggers history expansion on subsequent single-quoted commands it gets piped to

妖精的绣舞 提交于 2019-12-10 03:41:44
问题 I am on GNU bash, version 4.3.11. Say I want to print unique lines on a file. I am using this approach, which works well on a file: $ cat a 9 10 9 11 $ awk '!seen[$0]++' a 9 10 11 However, if I get the input from stdin, using double quotes in a multi-line and piping to awk, it fails: $ echo "9 > 10 > 9 > 11" | awk '!seen[$0]++' bash: !seen[$0]++': event not found That is, bash tries to expand the command seen , which of course does not know because it is a variable name. But it shouldn't

廉价移动计算的尝试

徘徊边缘 提交于 2019-12-10 00:03:20
背景 本人想做题,又苦于不想去机房。最简单的自我解决方法,无非自带电脑。 手机 之所以廉价,是因为自己本来就要带回学校的,就完全没有附加的花费了。 至于性能,手机是足够的。自己在用小米 9,跑得还挺快的。但问题在于没有完整的 GNU/Linux,又没有很好的 IDE,更没有方便的文件管理,导致做题效率低下,水题都切不掉。 用 Clang 而放弃 GNU C++ 特性并非问题,自己也不用 bits/ 中的头文件。主要问题仍然在于操作效率低。我甚至不能在 SYZOJ 系统的 OJ 上提交。 PocketCHIP 这个现在只能在闲鱼上花 400 块左右买到了。它确实有完整的系统,但是性能低下。苦于难用的电阻式触摸屏,它的操作效率也很低,更不必提他的键盘了。 实际上,它的系统也不甚崭新。停留在 Debian Jessie,内核版本也相对旧了。作为一个西洋式的项目,最终的目的也就只能在“能做”,而不能“最好”了。他背后的公司也如此。 诺亚舟 NP1500 这是一个偶然在 cncalc 上发现的电子词典,闲鱼售价大约 100 元。它运行基于 Qt 的 GUI,有终端。作为一个不正式的参赛者,它的软件版本已经老掉牙了。G++ 版本只为 3.,尚未测试 C++11 标准支持情况。买来也仅仅为了好玩,倒问题不大的。 Surface RT 不知道,没买。 ThinkPad X6x 不知道,没买。应该比

Adding GNU GPL Licence to C# App [closed]

試著忘記壹切 提交于 2019-12-09 20:14:04
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I know how to do this but I don't know is the StyleCop method true/working. Normally in StyleCop rules you must add this thing like this example to header (need to edit): //----------------------------------------------------------------------- // <copyright file="Widget.cs" company="Sprocket Enterprises"> //

Autotools library and object file output control

大兔子大兔子 提交于 2019-12-09 17:30:08
问题 My goal is to have all object files built in a .objs directory instead of the root of the Makefile, and to have the binaries (and libraries) copied into the project's bin/ directory. But I have been unable to find any resources to explain how to do this. How would I go about doing this? Here is my configure.ac and src/Makefile.am - I have similar Makefile.am files for two shared libraries that are referenced. They compile, and after copying them to the bin/ directory work as they should. I'm

GCC does not emit a warning when compiling [duplicate]

做~自己de王妃 提交于 2019-12-09 16:06:32
问题 This question already has an answer here : MinGW doesn't produce warnings (1 answer) Closed 4 years ago . The following code compiles and runs but I expect a warning when compiling: #include <stdio.h> #include <stdlib.h> int main(void){ int x = 10; printf("%p\n",&x); return EXIT_SUCCESS; } GCC,from an online compiler with command line argument -Wall -std=gnu99 -O2 -o a.out source_file.c -pedantic -Wextra gives out the following warning when compiling source_file.c: In function ‘main’: source

簡單編譯內核 linux kernel gnu

ε祈祈猫儿з 提交于 2019-12-09 10:22:18
需要 make, gcc 下戴內核檔 http://www.kernel.org 成為 root 進入 /usr/src 解壓縮 tar -xvf /home/關公/linux版本.tar.bz2 進入 /usr/src/linux版本 編內核參數(好多學問在這裡) make config ----------------------------------------------------------------- 或更簡單現代化點加 libncurses5-dev make menuconfig ----------------------------------------------------------------- 編譯內核 make 安裝 make modules_install install 進入 cd /boot 建開機準備檔 update-initramfs -c -k 內核號碼 更新啟動引導程序, 我的是 grub update-grub2 **************************************************************************** 簡單 debian 自動化方法 需要 make, gcc, libncurses5-dev, kernel-package, fakeroot 建目錄在個人目錄下

Trying to smash the stack

不羁岁月 提交于 2019-12-09 05:03:09
问题 I am trying to reproduce the stackoverflow results that I read from Aleph One's article "smashing the stack for fun and profit"(can be found here:http://insecure.org/stf/smashstack.html). Trying to overwrite the return address doesn't seem to work for me. C code: void function(int a, int b, int c) { char buffer1[5]; char buffer2[10]; int *ret; //Trying to overwrite return address ret = buffer1 + 12; (*ret) = 0x4005da; } void main() { int x; x = 0; function(1,2,3); x = 1; printf("%d\n",x); }

Convert milliseconds to timespec for GNU port

匆匆过客 提交于 2019-12-08 17:10:07
问题 I want to convert milliseconds into timespec structure used by GNU Linux. I have tried following code for the same. timespec GetTimeSpecValue(unsigned long milisec) { struct timespec req; //long sec = (milisecondtime /1000); time_t sec = (time_t)(milisec/1000); req->tv_sec = sec; req->tv_nsec = 0; return req; } Running this code gives me the following error. expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘GetTimeSpecValue’ I have also include time.h file in the code. 回答1: The

What's the difference between argp and getopt?

柔情痞子 提交于 2019-12-08 16:05:08
问题 I think the title is self explanatory. I am making a program and I was wondering what I should use of the two and why. 回答1: argp may be more flexible / powerful / etc, but getopt is part of the POSIX standard. Thats a choice you've to make based on whether you expect your program to be portable. 回答2: From the Argp manual: Argp provides features unavailable in the more commonly used getopt interface. These features include automatically producing output in response to the ‘--help’ and ‘-

EndView game on gnu Prolog [closed]

↘锁芯ラ 提交于 2019-12-08 15:34:58
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Problem in general : we have map 8*8 and we have to fill the empty squares with number from 1 to 6.But in each column and raw number