This file contains hidden or 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
| mkdir -p ~/.config | |
| ln -s ~/.vim ~/.config/nvim | |
| ln -s ~/.vimrc ~/.config/nvim/init.vim |
This file contains hidden or 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
| alias plot="gnuplot -p -e \"plot '-'\"" |
This file contains hidden or 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 <stdio.h> | |
| #include <assert.h> | |
| #define defer_(x) \ | |
| ({ typeof(x) fun(void) { return x; } fun; }) | |
| #define defer(n, x) \ | |
| typeof(x) (*n)() = defer_(x) | |
| int main(void) |
This file contains hidden or 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
| CC = clang | |
| CFLAGS = -Wall -Wextra | |
| CXX = clang++ | |
| CXXFLAGS = $(CFLAGS) -std=c++11 | |
| extern: extern.o extern_C.o | |
| $(CXX) $(CXXFLAGS) $^ -o $@ | |
| clean: |
This file contains hidden or 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
| CC = clang | |
| CFLAGS = -Wall -Wextra | |
| CXX = clang++ | |
| CXXFLAGS = $(CFLAGS) -std=c++11 | |
| extern_C: extern_C.o sum.o | |
| $(CXX) $(CXXFLAGS) $^ -o $@ | |
| clean: |
This file contains hidden or 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 <vector> | |
| #include <thread> | |
| #include <atomic> | |
| #include <cassert> | |
| int main() | |
| { | |
| std::vector<std::thread> threads(16); | |
| std::atomic<unsigned int> ai(0); |
This file contains hidden or 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 <stdio.h> | |
| #include <assert.h> | |
| #include <omp.h> | |
| int s; | |
| void loop(void) | |
| { | |
| int i; |
This file contains hidden or 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
| -- Programming in Lua, Chapter 10, Page 98 | |
| local N = 8 | |
| -- Number of solutions up to N=10 | |
| local num_solutions = {1, 0, 0, 2, 10, 4, 40, 92, 352, 724} | |
| -- Check whether (row, col) can be attacked by queens | |
| local function isok(queens, row, col) | |
| for i = 1, row-1 do |
This file contains hidden or 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
| #!/bin/bash | |
| # Use if unset or null | |
| echo ${x:-x} # x | |
| echo $x # | |
| # Assign if unset or null (only regular variables) | |
| echo ${y:=y} # y | |
| echo $y # y |
This file contains hidden or 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
| [read-line] | |
| M-n: complete-bar-next | |
| M-p: complete-bar-prev | |
| C-w: kill-prev-word |