This file contains 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 <Kit/Window.hpp> | |
#include <Kit/Renderer.hpp> | |
#include <Kit/Quad.hpp> | |
#include <Kit/Light.hpp> // Lights.. | |
#include <Kit/Camera.hpp> // Camera.. | |
#include <Kit/Model.hpp> // Action! | |
int main(int argc, char *argv[]){ |
This file contains 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
std::vector<projectile_t*> projectiles; | |
// ... | |
projectiles.erase( | |
std::remove_if(projectiles.begin(), projectiles.end(), | |
[](projectile_t *p){ return p->life <= 0.0; }), | |
projectiles.end() | |
); |
This file contains 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
g++ -fPIC -c hello.cpp | |
g++ -shared -o hello.so hello.o | |
g++ main.cpp -ldl |
This file contains 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
... | |
from OpenSSL import SSL | |
... | |
context = SSL.Context(SSL.TLSv1_2_METHOD) | |
context.use_privatekey_file('/etc/letsencrypt/live/DOMAIN.COM/privkey.pem') | |
context.use_certificate_chain_file('/etc/letsencrypt/live/DOMAIN.COM/fullchain.pem') | |
context.use_certificate_file('/etc/letsencrypt/live/DOMAIN.COM/cert.pem') |
This file contains 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
import math | |
from PIL import Image, ImageDraw | |
input_image = Image.open("first.png") | |
width,height = input_image.size | |
second_image = Image.new('RGB', input_image.size) | |
third_image = Image.new('RGB', input_image.size) | |
output_image = Image.new('RGB', input_image.size) | |
# draw = ImageDraw.Draw(output_image) |
This file contains 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 <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
// returns the sum of all 8 adjacent cells to element [cy][cx] in a 2D array, with bounds checking | |
uint32_t setdata(uint32_t root_max, uint32_t data[][root_max], uint32_t cx, uint32_t cy){ | |
uint32_t counter = 0; | |
if(cx + 1 < root_max){ | |
counter += data[cy][cx+1]; | |
if(cy - 1 >= 0) |
This file contains 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
import string | |
challenge = '''nyot babgr babgr kqtu kqtu kzshonp ylyk psqk | |
iix ewj rojvbkk phrij iix zuajnk tadv givslju ewj bda | |
-snip- | |
'''.split('\n') | |
primes = [int(x) for x in '2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101'.split(', ')] | |
letters = string.ascii_letters[:26] |
This file contains 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
import java.io.File; | |
-snip- | |
public class AoC7Solution { | |
static List<Node> nodes = new ArrayList<>(); | |
public static void main(String[] args) { | |
// Read input | |
try { |
This file contains 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
# generates a python script which runs the challenge input as code then prints out | |
# the largest integer in `locals()` and the largest value seen | |
with open('day8challengeinput','r') as f: | |
lines = f.read().split('\n') | |
def generate_code_from_input(): | |
headcode = 'largest = 0' | |
excode = '' | |
symbols = [] |
This file contains 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 <stdlib.h> | |
typedef struct { | |
void *prev; | |
void *next; | |
int value; | |
} Node; | |
Node* assembleRingNodes(int *nodeValues, int len){ |