Skip to content

Instantly share code, notes, and snippets.

Dracovian

Block or report user

Report or block Dracovian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Dracovian
Dracovian / updater.py
Last active Oct 22, 2019
OpenStreetMap updater script written for Python 3.7
View updater.py
from http.client import HTTPSConnection
from os import makedirs, getcwd, path
from re import findall as regex
from hashlib import md5
host, port = 'planet.openstreetmap.org', 443
def get_filehash(filename):
with open(filename, 'rb') as fp:
data = fp.read()
@Dracovian
Dracovian / HW4_01.c
Last active Sep 18, 2019
My 2019 rectification of my 2014 COSC 1301 code.
View HW4_01.c
/*
* Date: September 17, 2019
* Program: HW4_01.c
* Purpose: To determine if a date is valid.
*/
#include <stdio.h>
#include <stdlib.h>
/* We're using the Gregorian calendar which was introduced in October 1582. */
@Dracovian
Dracovian / HW4_01.c
Created Sep 17, 2019
COSC 1301 from 2014
View HW4_01.c
/*
Date: September 29, 2014
Program: HW4_01.c
Purpose: To determine if a date is valid.
*/
#include <stdio.h>
#include <math.h>
/* Including constants to assign integer values to boolean identifiers */
@Dracovian
Dracovian / pcg.js
Created Aug 24, 2019
PCG implementation in Javascript
View pcg.js
const multiplier = 6364136223846793005n;
function step(pcg) { pcg.state = pcg.state * multiplier + pcg.increment; }
function rot(value, rotation) { return (value >> rotation) | (value << ((- rotation) & 63n)); }
function out(state) { return rot((state >> 32n) ^ state, state >> 59n); }
function srandom(pcg, init, sequence) {
pcg.increment = (sequence << 1n) | 1n;
step(pcg);
@Dracovian
Dracovian / pcg.c
Last active Aug 22, 2019
PCG Random
View pcg.c
/* PCG stands for Permutable Congruence Generator and was written
* by Melissa O'Neill: https://www.cs.hmc.edu/~oneill/index.html
*
* The original sources for PCG can be found at: http://www.pcg-random.org/
*/
// When I create a function that prints to the console without printf, then this will truly become "portable".
#include <stdio.h>
// Return the number of ticks from the CPU since the last restart.
@Dracovian
Dracovian / nginx.conf
Last active Sep 6, 2019
Secure Nginx configuration for Linux hosts
View nginx.conf
user nobody; # Set the default user for nginx.
worker_processes auto; # The number of worker processes.
worker_rlimit_nofile 1024; # The maximum number of open files per worker process.
events {
worker_connections 512; # The number of worker connections.
use epoll; # Using epoll to handle connection processing (Linux 2.6+ only)
multi_accept on; # Allows for a worker process to accept multiple connections simultaneously.
}
@Dracovian
Dracovian / CMakeLists.txt
Last active Jun 1, 2019
Testing out some homemade string functions.
View CMakeLists.txt
cmake_minimum_required(VERSION 3.00)
project(interpreter C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER})
add_executable(interpreter main.c string.h string.c)
@Dracovian
Dracovian / extractor.c
Last active Jun 1, 2019
Simple extractor for Flash Projectors.
View extractor.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
// Decompress ZLIB input.
char* lzma_decompress(char* input)
{
char* output = NULL;
z_stream zlib_stream;
@Dracovian
Dracovian / implode.c
Last active Sep 19, 2019
Simple string joining method in C.
View implode.c
#include <stdio.h>
#include <stdlib.h>
size_t buffer_from_array(char** array) {
size_t buffer = 1;
for(int i = 0; i <= (int)(sizeof(array) / sizeof(char*)); i++)
buffer += strlen(array[i]);
return buffer;
}
@Dracovian
Dracovian / crc48.c
Created Nov 25, 2018
Implementing Gary Mussar's CRC48 for a more modern compiler.
View crc48.c
#include <stdio.h>
// Uncomment the define statement below to set this to be used on 32-bit operating systems.
// #define _32BIT
#include <crc48.h>
unsigned char testdata[] = {0x01, 0x3f, 0x03, 0xfe};
int main() {
int i;
You can’t perform that action at this time.