Skip to content

Instantly share code, notes, and snippets.

View emdeeeks's full-sized avatar

Gareth Griffiths emdeeeks

View GitHub Profile
@emdeeeks
emdeeeks / BlueBot.rb
Created October 23, 2018 21:29 — forked from waff1es/BlueBot.rb
the bot connects to discord and connects to whatever voice channel im in but it doesnt play any music ;_; |music_test works though
::RBNACL_LIBSODIUM_GEM_LIB_PATH = "C:/ruby22/libsodium.dll"
require 'discordrb'
require 'youtube-dl'
bot = Discordrb::Commands::CommandBot.new token: '<token here>', client_id: <client id here>, prefix: '|'
no_channel_warning = "You're not in a voice channel!"
bot.command :play do |event, songlink|
channel = event.user.voice_channel
@emdeeeks
emdeeeks / chat.rb
Created December 25, 2018 20:56 — forked from PurwadiPw/chat.rb
Simple chat ruby using eventmachine
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
class Server
attr_accessor :connections
def initialize
@connections = []
@emdeeeks
emdeeeks / emchat.rb
Created December 25, 2018 22:27 — forked from evilbetty/emchat.rb
Simple chat server with eventmachine
#!/usr/bin/env ruby
#
# Chat server attempt with Ruby and EventMachine.
#
# TODO:
#
# - Prevent chat from acting on \n (pressing enters in chat)
# - Handle (unexpected) disconnects properly (with unbind event).
# - Implement proper leaving with /quit.
@emdeeeks
emdeeeks / Gemfile
Created December 25, 2018 22:36 — forked from yaplik/Gemfile
Project for PV249 - Example SMTP Server with forwarding via smtp
source :rubygems
gem "eventmachine"
@emdeeeks
emdeeeks / dns.rb
Created February 5, 2019 16:29 — forked from honnix/dns.rb
play dns with ruby
#!/usr/bin/env ruby
# Copyright (c) 2009 Samuel Williams. Released under the GNU GPLv3.
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@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'],
@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 / 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 / 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 / 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!