Skip to content

Instantly share code, notes, and snippets.

@nicolas42
nicolas42 / compiling_building_c_cpp_notes.md
Created April 18, 2020 04:28 — forked from gubatron/compiling_building_c_cpp_notes.md
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015; August 29, 2019.

Include Paths

On the compilation phase, you will usually need to specify the different include paths so that the interfaces (.h, .hpp) which define structs, classes, constans, and functions can be found.

With gcc and llvm include paths are passed with -I/path/to/includes, you can pass as many -I as you need.

In Windows, cl.exe takes include paths with the following syntax: /I"c:\path\to\includes\ you can also pass as many as you need.

@nicolas42
nicolas42 / openicon.c
Created April 18, 2020 02:35 — forked from armornick/openicon.c
Draw an Image with SDL2
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "exit.png"
int main (int argc, char *argv[]) {
/*
Disclaimer: this is bad code
teapot.mp4 available here https://drive.google.com/file/d/0B3NaVR72FYQcWUFSUVhKWE5UMVU/view
modify filename to use on other mp4s
git clone https://github.com/pjreddie/darknet
put this file into the examples folder and then run these commands from the darknet directory
also you'll need yolov3.weights for this demo
Download a static build of ffmpeg which contains libass from https://www.ffmpeg.org/download.html. For example
wget https://evermeet.cx/ffmpeg/ffmpeg-96869-gb6879b61df.zip
Download the video
youtube-dl https://www.youtube.com/watch\?v\=SLGeFfxdEkA
Use that particular ffmpeg binary to render the subtitles. Pay attention to the start time on the subtitles since it will need to coincide. Set start time with -ss and the duration with -t.
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
rebol []
video-suffix: [
%.avi %.mpg %.mpeg %.divx %.mkv %.mov %.ogg %.rmvb %.rm
%.rmv %.m4v %.ogm %.m2v %.wmv %.flv %.mp4
]
image-suffix: [%.jpg %.jpeg %.png %.bmp %.gif]
audio-suffix: [%.mp3 %.aac %.wma %.m4a]
file-walk: func [
# Emacs
emacs -nw no window (for practice in cli version)
open file; C-x C-f
split pane horizontally, vertically, move between, exit out of pane; C-x 3 2 o 0
interactive search forward and reverse; C-s C-r
close; C-x C-c
shell; M-x eshell
new shell instance (for multiple independent shells); C-u M-x eshell
M-x load-theme tango
@nicolas42
nicolas42 / tmux.cheat
Created July 7, 2019 00:48 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@nicolas42
nicolas42 / real-time-latex-in-browser.html
Last active March 22, 2019 10:00 — forked from alecjacobson/real-time-latex-in-browser.html
Real-time LaTeX web application using MathJaX (e.g., for doing math during a Skype call)
<!DOCTYPE html>
<html>
<head>
<title>Real-time LaTeX in browser</title>
<!-- https://github.com/mathjax/MathJax/blob/master/test/sample-dynamic-2.html -->
<!-- Copyright (c) 2012-2015 The MathJax Consortium -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">