Skip to content

Instantly share code, notes, and snippets.

View akitaonrails's full-sized avatar

Fabio Akita akitaonrails

View GitHub Profile
@akitaonrails
akitaonrails / onemanga_downloader.rb
Created January 24, 2010 05:28
Download from onemanga.com
#!/usr/bin/env ruby
#
# Put this script in your PATH and download from onemanga.com like this:
# onemanga_downloader.rb Bleach [chapter number]
#
# You will find the downloaded chapters under $HOME/Documents/OneManga/Bleach
#
# If you run this script without arguments, it will check your local manga downloads
# and check if there are any new chapters
#
Unhandled exception: Cannot allocate new fiber stack: Cannot allocate memory (Errno)
GC Warning: Failed to expand heap by 2834432 bytes
GC Warning: Failed to expand heap by 790528 bytes
GC Warning: Out of Memory! Heap size: 5 MiB. Returning NULL!
Invalid memory access (signal 11) at address 0x60018
[0x5614ba5a4176] ???
[0x5614ba5a3e8f] __crystal_sigfault_handler +479
[0x7fd6dde91890] ???
[0x5614ba5931d5] ???
[0x5614ba59259b] ???
@akitaonrails
akitaonrails / iptables.rules
Created December 26, 2010 20:54
A configuração de iptables que uso em meus servidores pessoais.
# Generated by iptables-save v1.4.2 on Wed Feb 10 02:27:40 2010
*raw
:PREROUTING ACCEPT [50797:74255039]
:OUTPUT ACCEPT [25636:1371004]
COMMIT
# Completed on Wed Feb 10 02:27:40 2010
# Generated by iptables-save v1.4.2 on Wed Feb 10 02:27:40 2010
*nat
:PREROUTING ACCEPT [152:51984]
:POSTROUTING ACCEPT [41:2614]
@akitaonrails
akitaonrails / github_repos.rb
Created January 3, 2010 20:31
manage all github repositories (yours and watched) with a single command.
#!/usr/bin/env ruby
#
# Brute-force way to retrieve all Github's repositories at once
# Usage:
# github_repos.rb clone # will clone all the user's repositories
# github_repos.rb clone test # will just clone 6 repositories for testing purposes
# github_repos.rb pull # will update all of the user's local repositories
#
# If you have forked repositories, the original sources will be added
# as remotes with the default 'forked_from' name, and a new 'forked_from'
@akitaonrails
akitaonrails / load_discus.rake
Created March 14, 2010 03:39
Migrate your Enki comments to Discus
require 'disqus'
require 'disqus/api'
require 'disqus/author'
require 'disqus/forum'
require 'disqus/post'
require 'disqus/thread'
require 'disqus/version'
desc "Load Blog comments to Disqus"
task :load_disqus => :environment do
I, [2017-10-23T15:09:33.083276 #253] INFO -- : Connected to AMQP broker (prefetch: default)
I, [2017-10-23T15:09:42.797137 #253] INFO -- : Received: {"mailer_class":"TokenMailer","method":"activation","args":["fabio.akita@minerx.com.br","42473f74aa56ad1164fbf9389f617b50"],"locale":"en"}
F, [2017-10-23T15:09:42.797362 #253] FATAL -- : wrong number of arguments (given 3, expected 0) (ArgumentError)
/usr/local/bundle/gems/actionmailer-5.0.6/lib/action_mailer/base.rb:582:in `initialize'
/app/app/models/worker/email_notification.rb:12:in `new'
/app/app/models/worker/email_notification.rb:12:in `process'
/app/lib/daemons/amqp_daemon.rb:61:in `block (2 levels) in <top (required)>'
/usr/local/bundle/gems/bunny-1.2.2/lib/bunny/consumer.rb:56:in `call'
/usr/local/bundle/gems/bunny-1.2.2/lib/bunny/channel.rb:1672:in `block in handle_frameset'
/usr/local/bundle/gems/bunny-1.2.2/lib/bunny/consumer_work_pool.rb:84:in `block (2 levels) in run_loop'
@akitaonrails
akitaonrails / cr_chainable_methods.cr
Last active May 30, 2016 20:01
Attempt to implement a Pipe operator-like behavior in Crystal
# this was copied from https://carc.in/#/r/fg2
# thanks to @waterlink from this issue thread https://github.com/crystal-lang/crystal/issues/1388
module CrChainableMethods
module Pipe
macro pipe(ast)
{% uast = ast.stringify.gsub(/ >>/, ".pipe").id %}
{% pp uast %}
{% if uast.stringify != ast.stringify %}
pipe {{uast}}
@akitaonrails
akitaonrails / concurrency_2.cr
Last active May 29, 2016 03:47
Go to Crystal: Concurrency Tour #2 (https://tour.golang.org/concurrency/2)
def sum(s : Array(Int32), c : Channel(Int32))
c.send s.reduce(0) { |sum, v| sum + v }
end
def main
s = [7, 2, 8, -9, 4, 0]
c = Channel(Int32).new
spawn {
sum(s[0..((s.size / 2) - 1)], c)
}
@akitaonrails
akitaonrails / fake_pipe_operations.rb
Last active February 18, 2016 16:40
Simple Pipe like Operations in Ruby
module Pipe
def pipe(initial_state)
Pipe::PipeChain.new(initial_state, self)
end
class PipeChain
attr_reader :state, :context
def initialize(object, context)
@state = object
@akitaonrails
akitaonrails / Gemfile
Last active January 26, 2016 15:53
Slack Deleter
source 'https://rubygems.org'
gem 'faraday'
gem 'typhoeus'
gem 'oj'
gem 'parallel'