Skip to content

Instantly share code, notes, and snippets.

@Dracovian
Dracovian / confphp.sh
Last active May 26, 2021
PHP 8 configurator and rough steps for CentOS 8
View confphp.sh
#!/bin/bash
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
./configure \
--enable-fpm \
--with-fpm-systemd \
--with-fpm-acl \
--enable-fd-setsize=2048 \
--with-openssl \
@Dracovian
Dracovian / nginx.conf
Last active May 25, 2021
Nginx configurator and rough steps for RHEL 8
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 / urlshortener.py
Last active May 20, 2021
URL Shortener written in Python
View urlshortener.py
"""
Author: Dracovian <https://github.com/Dracovian>
Date : May 9, 2020
So far the purpose of this package is to create a web server using sockets
and we're looking to shorten URLs using this simple web server to facilitate
all of these requests.
"""
from socket import socket, AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
@Dracovian
Dracovian / 128bit.c
Last active Apr 15, 2021
Various C Snippets
View 128bit.c
typedef unsigned uint128_t __attribute__((mode(TI))); // https://gcc.gnu.org/onlinedocs/gccint/Machine-Modes.html
typedef unsigned uint256_t __attribute__((__vector_size__(64))); // Create a vector containing 64 32-bit unsigned values to have a total of 256-bits of potential data stored.
#define UINT128_CONSTANT(hi,lo) ((((uint128_t) hi) << 64) + lo) // Creating a 128-bit number by shifting a 64-bit number 64 bits and then adding the other 64-bit number into the zeroes made by the bit shift
#define UINT64_MAX (0xFFFFFFFFFFFFFFFFUL) // Setting the largest possible value for an unsigned 64-bit integer.
#define UINT32_MAX (0xFFFFFFFFU) // Setting the largest possible value for an unsigned 32-bit integer.
int main(void) {
uint128_t myVar = UINT128_CONSTANT(UINT64_MAX, UINT64_MAX);
uint256_t myVec = { UINT32_MAX, UINT32_MAX, UINT32_MAX, UINT32_MAX,
@Dracovian
Dracovian / C_LANGUAGE.md
Created Jul 31, 2020
Lessons in programming.
View C_LANGUAGE.md

Data Types:

Basic data type: int, char, float, double

  • Can have the following modifiers prepended to it:
    • short
    • long
    • signed
    • unsigned
    • long long
@Dracovian
Dracovian / videos.md
Last active Mar 22, 2021
Programming Stream Links
View videos.md

Title: [NodeJS] Discord Build-a-Bot Library

Description: A stream where I attempt to create a bot in NodeJS.

Stream Date: October 2, 2020

Upload Date: November 10, 2020

Length: 4h 4m 29s

@Dracovian
Dracovian / README.md
Last active Feb 21, 2021
Venom Linux spkgbuild files
View README.md

Usage:

  1. Clone the ports repository: git clone --depth=1 https://github.com/venomlinux/ports
  2. Create a new directory to store each of the custom spkgbuild files: mkdir -p ports/core/pkgname
  3. Write the contents of the custom spkgbuild files into the newly created directories: ports/core/pkgname/spkgbuild
  4. Change the file permissions to allow for execution for all users: chmod 755 ports/core/pkgname/spkgbuild
  5. Change the current directory to the package directory: cd ports/core/pkgname
  6. Run the following command to build the new package: pkgbuild
  7. Optionally install the new package: pkgbuild -i
@Dracovian
Dracovian / discord.cc
Last active Feb 6, 2021
Overly complicated bit of C++
View discord.cc
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/ssl.hpp>
#include <boost/beast/version.hpp>
#include <boost/asio/strand.hpp>
#include <cstdlib>
#include <functional>
#include <streambuf>
#include <iostream>
@Dracovian
Dracovian / install.php
Last active Dec 5, 2020
Install Composer and install Laravel and Twig on Windows
View install.php
<?php
// Access Protection and Infinite Runtime
if(!in_array(filter_input(INPUT_SERVER, 'REMOTE_ADDR'), ['127.0.0.1', '::1'])) http_response_code(403);
set_time_limit(0);
// Settings
define('PHP_DIR', 'C:\\path\\to\\php.exe'); // Edit this line to match your current PHP setup.
define('PROTECT', ['nbproject', 'public', 'index.php', 'install.php', '.vscode', 'assets', 'config', 'css', 'js', 'scss', 'sys', 'templates', 'package.json']);
define('HOME_DIR', dirname(__FILE__));
@Dracovian
Dracovian / autoclick.cc
Last active Oct 29, 2020
C++ Autoclicker
View autoclick.cc
#include <cstdio>
#include <cstdlib>
#define WINVER 0x500
#include <Windows.h>
#define VK_X 88
#define VK_Z 90
int x, y;