Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
busy, busy

Mike Bijon mbijon

🕶️
busy, busy
View GitHub Profile
@mbijon
mbijon / xss_clean.php
Last active Jun 12, 2021
XSS filtering in PHP (cleans various UTF encodings & nested exploits)
View xss_clean.php
<?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
@mbijon
mbijon / probabalistic-patterened-blur.rb
Created May 8, 2021
Example of complex blur using Image Magick + mini_magick
View probabalistic-patterened-blur.rb
# Copyright Ognjen Regoje, 2021
# https://ognjen.io/generating-more-interesting-image-previews-using-imagemagick/
#
####
require 'mini_magick'
INPUT_FILE = "input-1-lg.jpg"
image = MiniMagick::Image.open(INPUT_FILE)
size = image.dimensions.map{|x| x}
@mbijon
mbijon / webrick-ssl.rb
Created Apr 22, 2021 — forked from demisx/webrick-ssl.rb
Configure Webrick Server as SSL
View webrick-ssl.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'
module Rails
class Server < ::Rack::Server
def default_options
@mbijon
mbijon / git.nginx.conf
Created Mar 15, 2021
Serving git over "smart HTTP" >> nginx config for git-http-backend
View git.nginx.conf
# From: https://gemini.nytpu.com/gemlog/2021-03-07.gmi
########
#
# you should have other ssl configuration elsewhere...
server {
listen 443 ssl http2;
server_name git.nytpu.com;
charset utf-8;
# where cgit is installed to
@mbijon
mbijon / disable-xss-auditor.sh
Created Sep 19, 2016
CLI command to start Chrome with XSS Auditor disabled. Use for XSS/security testing
View disable-xss-auditor.sh
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' --disable-xss-auditor --enable-devtools-experiments --disable-features=enable-automatic-password-saving
@mbijon
mbijon / fft.php
Last active Aug 7, 2020
Fast Fourier Transform in PHP
View fft.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)
###################################################################
View polynomial_regression.py
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 18:59:49 2018
@author: Nhan Tran
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
@mbijon
mbijon / doorkeeper_config.md
Created Jun 2, 2020 — forked from jiggneshhgohel/doorkeeper_config.md
Doorkeeper (with JWT token) Server and Client applications configuration, references etc
View doorkeeper_config.md

Provider(aka Server)-side configuration, routes, controllers etc

Rails 5.0.0.1

Doorkeeper 4.2.6

Devise 4.2.0

Gemfile

@mbijon
mbijon / adabound.py
Created May 31, 2020 — forked from skitaoka/adabound.py
AdaBound AMSBound for Keras
View adabound.py
# coding: utf-8
"""
Based on Luo et al. (2019). Adaptive Gradient Methods with Dynamic Bound of Learning Rate. In Proc. of ICLR 2019.
"""
from tensorflow import keras
class AdaBound(keras.optimizers.Optimizer):
def __init__(self, lr=0.001, beta1=0.9, beta2=0.999, final_lr=0.1, gamma=1e-3, epsilon=None, weight_decay=0, amsbound=False, **kwargs):
super(AdaBound, self).__init__(**kwargs)
with keras.backend.name_scope(self.__class__.__name__):
@mbijon
mbijon / min-char-rnn.py
Created May 13, 2020 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)