Skip to content

Instantly share code, notes, and snippets.

View emdeeeks's full-sized avatar

Gareth Griffiths emdeeeks

View GitHub Profile
@emdeeeks
emdeeeks / cursor.rb
Created April 29, 2020 23:57 — forked from KINGSABRI/cursor.rb
Controlling Terminal Cursor in Ruby
class String
def mv_up(n=1)
cursor(self, "\033[#{n}A")
end
def mv_down(n=1)
cursor(self, "\033[#{n}B")
end
def mv_fw(n=1)
@emdeeeks
emdeeeks / ConsoleMenu.rb
Created April 27, 2020 22:33
Customizable Terminal Menu implemented in Ruby
require File.expand_path('KeyListener.rb', File.dirname(__FILE__))
require File.expand_path('ConsoleMods.rb', File.dirname(__FILE__))
# TODO Colorizations
# TODO Eventsystem? Any standarts?
# Creates a console menu consisting of different items.
# ::Navigate using arrowkeys
# ::Select item by pressing enter
# ::Exit by pressing escape
@emdeeeks
emdeeeks / Gemfile
Created April 26, 2020 02:10 — forked from JohnMorales/Gemfile
ruby loco hack night project to convert an image to ascii art
source "https://rubygems.org"
gem 'pry'
# gem "ascii-image"
gem "rmagick", "=2.13.1"
gem "rainbow", "= 1.1.4"
gem "pry-rescue"
gem "paint"
require 'rubygems'
require 'eventmachine'
module Telnet
# :stopdoc:
IAC = 255.chr # "\377" # "\xff" # interpret as command
DONT = 254.chr # "\376" # "\xfe" # you are not to use option
DO = 253.chr # "\375" # "\xfd" # please, you use option
WONT = 252.chr # "\374" # "\xfc" # I won't use option
WILL = 251.chr # "\373" # "\xfb" # I will use option
@emdeeeks
emdeeeks / compiler.rb
Created April 12, 2020 21:21 — forked from barnaby/compiler.rb
Compile & execute Ruby as bytecode. Works in 1.9.3
#
#
# Compile & execute Ruby as bytecode
#
#
require 'rbconfig'
require 'dl'
require 'fiddle'
require 'strscan'
@emdeeeks
emdeeeks / cheat_sheet.rb
Created November 2, 2019 12:36 — forked from juanmaree/cheat_sheet.rb
[Ruby Cheat] Cheatsheet #ruby
# This is a comment
# In Ruby, (almost) everything is an object.
# This includes numbers...
3.class #=> Integer
# ...and strings...
"Hello".class #=> String
# ...and even methods!
@emdeeeks
emdeeeks / README.md
Created June 14, 2019 08:56 — forked from helloworld-du/README.md
git hook(pre commit)

pre-commit hook

by [email protected] 原始地址: pre-commit hook

功能简述

1、在提交代码(git commit)到git库时,本钩子被触发。
2、调用phpcbf和phpcs,来做代码检查并尝试自动修复代码样式。

@emdeeeks
emdeeeks / post-receive
Created April 11, 2019 12:07 — forked from richpeck/post-receive
Post Receive Hook
#!/usr/bin/env ruby
# REF => https://gist.github.com/karmi/442106#file-post-receive-deploy-rb-L21
###################################################
# === CONFIGURE THE SCRIPT HERE ================= #
deploy_branch = 'master' #=> change to production
git_path = Dir.pwd
application_path = File.dirname(git_path) + "/current"
@emdeeeks
emdeeeks / campirc.rb
Created March 25, 2019 17:19 — forked from rkh/campirc.rb
# coding: binary
# IRC <-> Campfire bridge, set IRC password to SUBDOMAIN:TOKEN and connect to localhost:6667
# Remove special chars/spaces from channel names (ie "Foo Bar" becomes #FooBar). Only tested with LimeChat.
# gem install excon && gem install yajl-ruby -v "< 2.0"
%w[socket thread uri excon yajl yajl/http_stream].each { |lib| require lib }
Thread.abort_on_exception = true
[:INT, :TERM].each { |sig| trap(sig) { exit } }
server = TCPServer.new('127.0.0.1', 6667)
loop do
@emdeeeks
emdeeeks / rand_dialer2.rb
Created February 5, 2019 16:32 — forked from amboxer21/rand_dialer2.rb
Randomly calls the new guys every 10 minutes via cron script
#!/usr/local/bin/ruby
require 'net/ssh'
require 'optparse'
ASTERISK_RX = '/usr/sbin/asterisk -rx '
@rand = Random.rand(1..3)
@user = {1 => ['270','cell phone number goes here'],
2 => ['182','cell phone number goes here'],