Skip to content

Instantly share code, notes, and snippets.

Brian Leishman BrianLeishman

Block or report user

Report or block BrianLeishman

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
@BrianLeishman
BrianLeishman / b64u.c
Last active Jul 3, 2018
Base64 encoding (URL style, with "-_" instead of "+/" and no "=") as a MySQL UDF
View b64u.c
/*
* Copyright (c) 2017, Brian Leishman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
@BrianLeishman
BrianLeishman / udf.go
Created Apr 16, 2018
MySQL UDF written in Go (Golang) instead of C
View udf.go
package main
// #include <stdio.h>
// #include <sys/types.h>
// #include <sys/stat.h>
// #include <stdlib.h>
// #include <string.h>
// #include <mysql.h>
// #cgo CFLAGS: -D ENVIRONMENT=0 -I/usr/include/mysql -fno-omit-frame-pointer
import "C"
@BrianLeishman
BrianLeishman / bid2.c
Last active Jul 12, 2018
MySQL UDF for an 8-byte time & environment based ID
View bid2.c
/*
* Copyright (c) 2018, Brian Leishman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
@BrianLeishman
BrianLeishman / unhex_sha3.c
Last active Feb 27, 2018
MySQL UDF for generating SHA3 hashes without hex encoding (much faster)
View unhex_sha3.c
/*
* Copyright (c) 2018, brian
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
@BrianLeishman
BrianLeishman / sha3.c
Last active Feb 27, 2018
MySQL UDF for sha3 hash generation
View sha3.c
/*
* Copyright (c) 2018, brian
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
@BrianLeishman
BrianLeishman / imap.php
Last active Mar 1, 2018
Pure PHP, basic IMAP implementation
View imap.php
<?php
/*
* Copyright (c) 2018, brian
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
@BrianLeishman
BrianLeishman / unhtml.c
Created Feb 4, 2018
MySQL `unhtml` UDF for converting HTML to plain text, removing tags and converting HTML entities
View unhtml.c
/*
* Copyright (c) 2018, brian
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
@BrianLeishman
BrianLeishman / bid.c
Last active Dec 20, 2017
BID for MySQL (9-byte, time based ID generator)
View bid.c
/*
* Copyright (c) 2017, Brian Leishman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
You can’t perform that action at this time.