Skip to content

Instantly share code, notes, and snippets.

@F-3r
F-3r / trojan.sh
Last active February 28, 2023 16:31
trojan.sh
echo
echo
echo "+================================+"
echo "| you have been hacked!. Sorry |"
echo "+================================+"
echo
@F-3r
F-3r / arlt.rb
Created November 20, 2019 13:13
Markov chain implementation for the arlt.rb bot
class Markov
PHRASE_SEPARATOR = /[\.;]/
WORD_SEPARATOR = " "
attr_reader :knowledge, :order
def initialize(order: 2)
@knowledge = {}
@order = order
end
@F-3r
F-3r / check.rb
Created November 19, 2019 00:39
testing proto-framework
class Verify
attr_reader :subject
def initialize(subject)
@subject = subject
end
def eq(b)
if subject == b
puts "\e[38;5;51m +1 \e[0m"
@F-3r
F-3r / chroot-to-pi.sh
Created February 27, 2019 03:20 — forked from htruong/chroot-to-pi.sh
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
@F-3r
F-3r / hyperspace.rb
Created July 13, 2018 04:43
mini interactive visualization made in ruby + gosu
require 'gosu'
class Window < Gosu::Window
attr_accessor :hyperspace
def initialize(width, height)
super(width, height, false)
@hyperspace = HyperSpace.new
end
@F-3r
F-3r / gcm-test.rb
Created August 20, 2014 18:02
Dirty ruby script for testing Google Cloud Messaging clients
#!/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
api_key = ENV['KEY']
uri = URI('https://android.googleapis.com/gcm/send')
msg = ARGV.shift
ids = ARGV
@F-3r
F-3r / base.rb
Last active August 29, 2015 14:02
an implementation of halt
require 'forwardable'
module Hobbit
class Base
class << self
extend Forwardable
def_delegators :stack, :map, :use
%w(DELETE GET HEAD OPTIONS PATCH POST PUT).each do |verb|
@F-3r
F-3r / method_override.md
Last active January 2, 2016 07:49
Client side functionality for Rack::MethodOverride using plain Vanilla Javascript.

This attempt is fairly easy, creates a form which takes href of the link as action, method is always POST and adds the _method param. The link onclick's, prevents the default event functionality and submits such form instead.

//method_override.js

methodOverride = function(){
  handler = function(event){
    event.preventDefault();

 form = document.createElement('form');
@F-3r
F-3r / hash_tree.rb
Last active December 16, 2015 07:38
HashTree
class HashTree < Hash
def self.new
super { |h, k| h[k] = new(&h.default_proc) }
end
def path=(*nodes, value)
k = nodes.shift
if nodes.empty?
self[k] = value
else