Skip to content

Instantly share code, notes, and snippets.

View onlineth's full-sized avatar
:shipit:

Thomas Hein onlineth

:shipit:
  • Illinois, United States
View GitHub Profile
@jamesgmarks
jamesgmarks / gist:56502e46e29a9576b0f5afea3a0f595c
Last active March 12, 2024 19:30
MySQL/MariaDB BIN_TO_UUID and UUID_TO_BIN Polyfill
DELIMITER //
CREATE FUNCTION BIN_TO_UUID(b BINARY(16))
RETURNS CHAR(36)
BEGIN
DECLARE hexStr CHAR(32);
SET hexStr = HEX(b);
RETURN LOWER(CONCAT(
SUBSTR(hexStr, 1, 8), '-',
SUBSTR(hexStr, 9, 4), '-',
@mort3za
mort3za / git-auto-sign-commits.sh
Last active May 7, 2024 01:45
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@Garrett-R
Garrett-R / gzip_str.py
Last active March 12, 2022 10:17
Demo of how to gzip and gunzip a string in Python 3
"""How to gzip a string.
This works for Python 3.2. For 3.1-, look at the original gist (under "Revisions")
"""
import gzip
def gzip_str(string_: str) -> bytes:
return gzip.compress(string_.encode())
#!/bin/bash
# Setup and enable auditd
# MUST REBOOT AFTER SETUP
#
# FUNCTIONALITIES:
#
# * Auditing user TTY
# aureport --tty
#
# * Auditing root commands (real uid)
@IzzySoft
IzzySoft / SR AutoReview DefaultComments
Last active April 2, 2019 22:02
Default comments for SoftwareRecs.SE to be used with @Benjol's SE-AutoReviewComments
###[Q]Low question quality
We will need much more information to give good recommendations here. Please take a look at [What is required for a question to contain "enough information"?](//softwarerecs.meta.stackexchange.com/q/336/185) Then please [edit] your question and see if you can incorporate some of these improvements.
###[Q]Requesting assets
Please note this site is about recommending *software,* not assets or [resources](//softwarerecs.meta.stackexchange.com/q/2470/185) like [howtos](//softwarerecs.meta.stackexchange.com/q/882/185), [manuals/tutorials](//softwarerecs.meta.stackexchange.com/q/1258/185), [multi-media content](//softwarerecs.meta.stackexchange.com/q/935/185), [code fragments](//softwarerecs.meta.stackexchange.com/q/904/185), etc. If you're looking for data, our sister-site [Open Data](//opendata.stackexchange.com/help/on-topic) might be worth checking with.
###[Q]Asking for alternatives without explicit requirements
We will need much more information to give good recommendations here –
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@phpdistiller
phpdistiller / sanitize_database_inputs.php
Last active January 1, 2016 00:38
This snippet sanitizes database inputs.
<?php
// Source : http://css-tricks.com/snippets/php/sanitize-database-inputs/
// Function for stripping out malicious bits
function cleanInput($input) {
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
@botaor
botaor / Sanitize.php
Created May 28, 2013 10:21
Sanitize database inputs in PHP
<?php
function cleanInput($input)
{
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments
);
@ck-on
ck-on / ocp.php
Last active March 25, 2024 09:30
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active April 17, 2024 12:35
Using Git with Subversion Mirroring for WordPress Plugin Development