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 / totp.php
Created May 27, 2020
Jetbrains PhpStorm stub for my php_totp extension.
View totp.php
<?php
/**
* Generate a Base32 encoded string.
* @link https://en.wikipedia.org/wiki/Base32
* @param string $input <p>
* The input string that you want to encode.
* </p>
* @return string If it succeeds to encode the string.
*/
@Dracovian
Dracovian / PKGBUILD
Created May 27, 2020
PHP 8.0.0-dev PKGBUILD for Arch-based distributions.
View PKGBUILD
pkgbase="php"
pkgname=("php")
pkgver=8.0
pkgrel=0
arch=('x86_64')
license=('PHP')
url='https://www.php.net/'
makedepends=('bison' 're2c' 'systemd-libs' 'acl' 'libxml2' 'openssl' 'sqlite'
'bzip2' 'curl' 'systemd' 'libpng' 'icu' 'oniguruma' 'libsodium'
'postgresql-libs' 'argon2' 'tidy' 'pcre2' 'icu' 'libxslt' 'libzip'
@Dracovian
Dracovian / alloc.h
Last active May 27, 2020
Some useful C snippets.
View alloc.h
/*
* This is a slightly modified copy of the malloc/free example from Brian Kernighan and Dennis Ritchie
* Eventually I'll figure out a way to futher compress this code and to replace the sbrk requirement altogether.
* There's currently no ETA on either of those, but there'll be some additions and modifications to this Gist.
*/
#ifndef __NASTY_ALLOC_H
#define __NASTY_ALLOC_H
#undef NALLOC
View exabot.js
const { Client } = require('discord.js'),
client = new Client(),
mysql = require('mysql'),
process = require('process'),
developer = false;
class Exabot {
constructor(prefix) {
this.prefix = prefix === '' ? prefix : '.';
@Dracovian
Dracovian / neko-news.js
Last active May 16, 2020
Neko News Bot
View neko-news.js
const { Client } = require('discord.js'), client = new Client(),
Parser = require('rss-parser'), parser = new Parser(),
process = require('process');
class News {
constructor(guild) {
this.guild = guild;
}
async rgb(r, g, b) {
@Dracovian
Dracovian / print_x64.c
Last active May 12, 2020
I'll just store some inline assembly related stuff in here.
View print_x64.c
static void print(const char *message, long length) {
asm ("mov $1, %rax"); // Call OS function sys_write.
asm ("mov $1, %rdi"); // Set sys_write stream to STDOUT or standard output.
asm ("mov %0, %%rsi" :: "S"(message)); // The message string
asm ("mov %0, %%rdx" :: "d"(length)); // The message length
asm ("syscall"); // Transfer control back to the OS.
}
@Dracovian
Dracovian / openlibrary.c
Created Mar 28, 2020
Cross-platform method of accessing functions within shared objects/libraries.
View openlibrary.c
#include <stdio.h>
#include <string.h>
/* Preprocessor Macros */
#ifdef _WIN32
#include <windows.h>
#define EXTENSION ".dll"
#define OPENLIB(a) LoadLibrary(a)
#define CALLFUNC(a, b) GetProcAddress(a, b)
#define CLOSELIB(a) FreeLibrary(a)
@Dracovian
Dracovian / pytime.cc
Last active Feb 18, 2020
Incomplete C++ stuff for ArchAlessus
View pytime.cc
#ifdef __cplusplus
#include <cstdio>
#include <cstdlib>
#include <ctime>
/*
* We're not going to bother to extern "C" this whole file despite that
* being the preferred route to take when writing code that can be compiled
* as C or C++.
*
View CIDR Ranges IPv4
Legend:
IPv4/CIDR = Starting IPv4 - Ending IPv4 | Number of IP addresses (Binary Formatting of Subnet) - Subnet Address
0.0.0.0/32 = 0.0.0.0 - 0.0.0.0 | 1 address (11111111 11111111 11111111 11111111) - 255.255.255.255
0.0.0.0/31 = 0.0.0.0 - 0.0.0.1 | 2 addresses (11111111 11111111 11111111 11111110) - 255.255.255.254
0.0.0.0/30 = 0.0.0.0 - 0.0.0.3 | 4 addresses (11111111 11111111 11111111 11111100) - 255.255.255.252
0.0.0.0/29 = 0.0.0.0 - 0.0.0.7 | 8 addresses (11111111 11111111 11111111 11111000) - 255.255.255.248
0.0.0.0/28 = 0.0.0.0 - 0.0.0.15 | 16 addresses (11111111 11111111 11111111 11110000) - 255.255.255.240
0.0.0.0/27 = 0.0.0.0 - 0.0.0.31 | 32 addresses (11111111 11111111 11111111 11100000) - 255.255.255.224
0.0.0.0/26 = 0.0.0.0 - 0.0.0.63 | 64 addresses (11111111 11111111 11111111 11000000) - 255.255.255.192
@Dracovian
Dracovian / archiver.py
Created Jan 27, 2020
What I used to manage my master tracks.
View archiver.py
from os import makedirs, getcwd, walk, path
from zipfile import ZipFile, ZIP_DEFLATED
def create_archive(filename, root, files):
zipfile = path.join(getcwd(), 'Archives')
if not path.exists(zipfile):
makedirs(zipfile)
zipfile = path.join(zipfile, filename)
You can’t perform that action at this time.