- Install Nix, the functional package manager. You'll need Linux (but macOS might work too).
- Make sure you have at least 4 GB of free space available for
/tmpand a few GB of free space available for/nix. - To get my recipes, run:
git clone https://github.com/DavidEGrayson/nixcrpkgs && cd nixcrpkgs && git checkout 4f7b11dThat commit is the current tip of the dev/david/2019 branch. - To build a i686-w64-mingw32 C/C++ cross-compiling toolchain and a hello world program, run:
nix-build -A win32.hello - To build Qt and its examples, run:
nix-build -A win32.qt.examples - To just build the toolchain itself, run:
nix-build -A win32.gcc
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
| diff --git a/code/15_hello_triangle.cpp b/code/15_hello_triangle.cpp | |
| index 532520e..31f2bd7 100644 | |
| --- a/code/15_hello_triangle.cpp | |
| +++ b/code/15_hello_triangle.cpp | |
| @@ -642,12 +642,15 @@ private: | |
| void drawFrame() { | |
| vkWaitForFences(device, 1, &inFlightFences[currentFrame], VK_TRUE, UINT64_MAX); | |
| + VkFence waited = inFlightFences[currentFrame]; |
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
| // Compile with: gcc -g bad.c -lvulkan -lgdi32 -lglfw3 | |
| #define VK_USE_PLATFORM_WIN32_KHR | |
| #include <vulkan/vulkan.h> | |
| #define GLFW_EXPOSE_NATIVE_WIN32 | |
| #include <GLFW/glfw3.h> | |
| #include <GLFW/glfw3native.h> | |
| #include <string.h> | |
| #include <stdlib.h> |
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
| # Reduce file size. Might need '-vcodec libx264' in some cases? | |
| ffmpeg -i foo.mp4 -crf 28 foo_out.mp4 | |
| # Reduce file size, rescale to 1080p, and crop in time and space. | |
| ffmpeg -i foo.mp4 -crf 28 -ss 00:00:25 -to 00:01:15 -vf "scale=1920:-1,crop=1920:800:0:1900" foo_out.mp4 | |
| # Reduce file size, crop a video in time and scale it to 1080p | |
| ffmpeg -i foo.mp4 -crf 28 -ss 00:01:00 -to 00:00:10 -vf scale=1920:-1 output.mp4 | |
| ffprobe foo.mp4 # Make sure the audio stream is aac. |
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
| [root@alderaan gradual]# pacman -Sy archlinux-keyring | |
| :: Synchronizing package databases... | |
| core is up to date | |
| extra is up to date | |
| community is up to date | |
| warning: archlinux-keyring-20180108-1 is up to date -- reinstalling | |
| resolving dependencies... | |
| looking for conflicting packages... | |
| Packages (1) archlinux-keyring-20180108-1 |
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
| $ clang-format --version | |
| clang-format version 5.0.0 (tags/RELEASE_500/final) | |
| $ cat .clang-format | |
| AllowShortBlocksOnASingleLine: true | |
| $ cat test.cpp | |
| int foo(int x) | |
| { | |
| if (x == 0) { return 1; } |
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
| $ cat somefile.h | |
| struct a; | |
| struct a *init(); | |
| void setd(struct a*p, int dd); | |
| int getd(struct a*p); | |
| void cleanup(struct a*p); | |
| $ cat somefile.c |
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
| $ cat test.sh | |
| #!/bin/sh | |
| for a in 0; do | |
| echo b=$(echo "c-d" | tr - _) | |
| done | |
| $ . test.sh | |
| b=c_d |
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
| $ cat test.c | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(int argc, char ** argv) | |
| { | |
| for(int i = 0; i < argc; i ++) | |
| { | |
| printf("%d = %s\n", i, argv[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
| $ cat /dev/bus/usb/001/002 | head -c18 | hexdump | |
| 0000000 0112 0110 0000 0800 80ee 0021 0100 0301 | |
| 0000010 0100 | |
| 0000012 | |
| $ lsusb | |
| Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet | |
| Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub |