Skip to content

Instantly share code, notes, and snippets.

View mbijon's full-sized avatar
🎯
Focusing

Mike Bijon mbijon

🎯
Focusing
View GitHub Profile
@mbijon
mbijon / fft.php
Last active February 17, 2024 03:46
Fast Fourier Transform in PHP
<?php
// !!! Warning: for reference, not debugged
###################################################################
# PHP_Fourier 0.03b
# Original Fortran source by Numerical Recipies
# PHP port by Mathew Binkley (binkleym@nukote.com)
###################################################################
@mbijon
mbijon / disable-xss-auditor.sh
Created September 19, 2016 19:04
CLI command to start Chrome with XSS Auditor disabled. Use for XSS/security testing
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --disable-xss-auditor --enable-devtools-experiments --disable-features=enable-automatic-password-saving
@mbijon
mbijon / wordpress-remove-media_buttons.php
Last active July 10, 2023 23:30
Remove 'Add Media' button from above WP editor, per post-type
function check_post_type_and_remove_media_buttons() {
global $current_screen;
// use 'post', 'page' or 'custom-post-type-name'
if( 'post' == $current_screen->post_type ) add_action( 'media_buttons_context' , create_function('', 'return;') );
}
add_action('admin_head','check_post_type_and_remove_media_buttons');
@mbijon
mbijon / measure_img_similarity.py
Created October 20, 2019 07:16 — forked from duhaime/measure_img_similarity.py
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
@mbijon
mbijon / xss_clean.php
Last active November 1, 2022 03:23
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
<?php
/*
* XSS filter, recursively handles HTML tags & UTF encoding
* Optionally handles base64 encoding
*
* ***DEPRECATION RECOMMENDED*** Not updated or maintained since 2011
* A MAINTAINED & BETTER ALTERNATIVE => kses
* https://github.com/RichardVasquez/kses/
*
* This was built from numerous sources
Encoded Traversal Strings:
../
..\
..\/
%2e%2e%2f
%252e%252e%252f
%c0%ae%c0%ae%c0%af
%uff0e%uff0e%u2215
%uff0e%uff0e%u2216
@mbijon
mbijon / gist:7468011
Created November 14, 2013 14:44
spammer's comment-generation code, from: http://pastebin.com/y4NgSPut# (Accidentally posted in comment thread instead of fake comment...)
{
{I have|I’ve} been {surfing|browsing} online more than {three|3|2|4} hours today,
yet I never found any interesting article like yours. {It’s|It is}
pretty worth enough for me. {In my opinion|Personally|In my view},
if all {webmasters|site owners|website owners|web owners} and bloggers
made good content as you did, the {internet|net|web} will be {much
more|a lot more} useful than ever before.|
I {couldn’t|could not} {resist|refrain from} commenting.
{Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I’ll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can’t} {in finding|find|to
@mbijon
mbijon / nginx.conf
Last active January 26, 2022 15:12 — forked from Stanback/nginx.conf
Nginx CORS-support for proxied Grape/Rails/Passenger APIs
#
# CORS-header support example while nginx proxies Rails/Grape + Passenger
# ...not a complete config file
#
server {
listen 443 ssl;
root /foo/public;
# Modify for API-specific
try_files $uri/index.html $uri @passenger;
@mbijon
mbijon / class-search.php
Created December 11, 2015 08:19 — forked from arsonus/class-search.php
A PHP script to search a MySQL database
<?php
/**
* Performs a search
*
* This class is used to perform search functions in a MySQL database
*
* @version 1.0
* @author John Morris <support@johnmorrisonline.com>
*/
class search {
@mbijon
mbijon / algol_svd.py
Created January 29, 2016 09:07
Almost exact translation of the ALGOL SVD algorithm published in Numer. Math. 14, 403-420 (1970) by G. H. Golub and C. Reinsch -- http://161.111.227.80/compbio/material/algoritmos3D/files/SVD.py
# Almost exact translation of the ALGOL SVD algorithm published in
# Numer. Math. 14, 403-420 (1970) by G. H. Golub and C. Reinsch
#
# Copyright (c) 2005 by Thomas R. Metcalf, helicity314-stitch <at> yahoo <dot> com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#