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
>*NIX only | |
>it is baffling how everyone only ever says "uh oh use ncurses or something" | |
{ | |
// @BAKE gcc -o $*.out $@ | |
#include <sys/ioctl.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
int get_tty_size(int * width_out, int * height_out) { | |
struct winsize ws; |
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
>since MySQL uses an internal system for identifying users a few hoops must be jumped | |
>root is always preregistered | |
1. Log in as root | |
$ sudo mysql | |
2. Create a new user | |
CREATE USER '<your_name>'@'localhost' IDENTIFIED BY '<password>'; | |
>NOTE: <password> doesnt have to be the same as the user's system login password | |
3. Grant privileges to the new user | |
GRANT ALL PRIVILEGES ON *.* TO '<your_name>'@'localhost'; |
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
//@BAKE g++ $@ $(pkg-config --cflags --libs ncurses readline) | |
/* NOTE: | |
* We are using C++ here to have access to lambdas. | |
* The C version would look exactly like this, but with traditional callback functions. | |
*/ | |
#include <ncurses.h> | |
#include <readline/readline.h> | |
#define WINDOW_WIDTH 32 |
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
{ | |
// --- AnimalRepository.java --- | |
/* By using the Farm package here, | |
* we make the contents of | |
* FarmApplication.java visible | |
*/ | |
package com.example.Farm; | |
import org.springframework.data.jpa.repository.JpaRepository; |
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
1. Set up dependencies | |
-gateway is all we need: | |
spring-cloud-starter-gateway | |
-NOTE: in case you missed it during initialization, | |
this is how it would look like under gradlew: | |
{ | |
dependencies { | |
implementation 'org.springframework.cloud:spring-cloud-starter-gateway' | |
} |
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
{// examples | |
>the goal is the same with each methodology | |
>we have data.txt | |
>it contains key-value pairs | |
¤its generated with this script | |
{ @begin=sh@ | |
#!/bin/bash | |
# generator.sh |
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
1. Assume the following type in C | |
{ | |
typedef struct { | |
int i; | |
} hello_world_t; | |
// and an exemplary instance | |
hello_world_t my_hw; | |
} | |
>NOTE: compiling with debugging information is required (-ggdb under 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
XXX: | |
>basic knowledge of public key cryptography | |
>the server holds a public key, while the client has a private key | |
which it will use for authentication | |
>this way we protect from brute forcing attacks and | |
optionally avoid having to enter a password manually when connecting | |
1. Create a key pair | |
Green( anon@Client )$ ssh-keygen | |
"Generating public/private rsa key pair." |
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
{ // sdl_hw.c | |
// @BAKE gcc $@ -o sdl_hw.out -Wall -Wpedantic $(pkg-config --cflags --libs sdl2) | |
#include <SDL.h> | |
signed main(int argc, char* argv[]) { | |
SDL_Init(SDL_INIT_VIDEO); | |
SDL_Window* window = SDL_CreateWindow("HW", 0, 0, 800, 800, SDL_WINDOW_SHOWN); | |
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); |
NewerOlder