Skip to content

Instantly share code, notes, and snippets.

View zotherstupidguy's full-sized avatar

Mo zotherstupidguy

  • hackspree
  • simplicity is the final achievement
View GitHub Profile
@zotherstupidguy
zotherstupidguy / api.rb
Last active August 29, 2015 14:16 — forked from noahhendrix/api.rb
module Todo
class API < Grape::API
use Rack::Session::Cookie
version 'v1', :format => :json
helpers do
def current_user
return nil if env['rack.session'][:user_id].nil?
@current_user ||= User.get(env['rack.session'][:user_id])
end
#########################################
# Very basic rack application showing how to use a router based on the uri
# and how to process requests based on the HTTP method used.
#
# Usage:
# $ rackup rack_example.ru
#
# $ curl -X POST -d 'title=retire&body=I should retire in a nice island' localhost:9292/ideas
# $ curl -X POST -d 'title=ask Satish for a gift&body=Find a way to get Satish to send me a gift' localhost:9292/ideas
# $ curl localhost:9292/ideas
@zotherstupidguy
zotherstupidguy / convert.rb
Last active August 29, 2015 14:17
Anime Converting
# First We sort via creation time and rename simply
files = Dir.glob("*.mkv")
count = 0
files.each { |file| File.new(file, "r").ctime}.sort.each do |file|
p File.basename(file, '.mkv').to_s
File.rename(file, (count += 1).to_s + ".mkv")
p count
end
# then we convert
# No code is faster than no code.
require 'rack'
require 'json'
module Utter
class Builder < Rack::Builder
end
@zotherstupidguy
zotherstupidguy / irccat
Last active August 29, 2015 14:21 — forked from vivien/irccat
#!/bin/sh
# Copyright 2014 Vivien Didelot <[email protected]>
# Licensed under the terms of the GNU GPL v3, or any later version.
#Jarkko Oikarinen first introduced IRC to the world in 1988. Five years later, he clearly defined the IRC protocol in RFC 1459, which made the whole protocol much more accessible. Armed with this information, you can get a better understanding of this simple text-based protocol and learn how to connect to IRC servers without using a special client. Once you have mastered this, you should find it a trivial task to write programs that connect to IRC.
#netcat kornbluth.freenode.net 6667
#The USER command is used to set the login, user modes, and real name. If I wanted to have a login of "paul," I would type the following, followed by Enter:
#NICK zotherstupidguy\rUSER foo x x whatever
@zotherstupidguy
zotherstupidguy / ips.sh
Last active May 10, 2017 16:41
IRC Channel IPs
#!/bin/sh
NICK=itouchthings
SERVER=irc.freenode.net
PORT=6667
CHAN="#ruby"
#PRIVMSG $CHAN :Greetings!
{
# join channel and say hi

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Thu, 03 Apr 2014 02:35:55 GMT till Fri, 03 Apr 2015 02:35:55 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 386)
@zotherstupidguy
zotherstupidguy / terminal-pinwheel.rb
Last active September 28, 2015 08:35 — forked from vy-let/terminal-pinwheel.rb
Print a clockwise-spinning pinwheel on an ANSI-compliant terminal.
#!/usr/bin/env ruby
#TODO add some colors to the circle
begin
loop do
%w( ◐ ◓ ◑ ◒ ).each do |pchar|
print "\x1b[1G\x1b[0K#{pchar} "
sleep 0.1
end
end
@zotherstupidguy
zotherstupidguy / ARCHANONIRC.md
Created September 30, 2015 09:20
A Quick Guide for Anonymous and Pseudonymous irc

##Weechat+Arch Linux+Tor ###A Quick Guide for Anonymous and Pseudonymous irc I'm going to assume you know what irc is, and generally how it works. If you haven't gotten that far watch a youtube video and try out some of the commands on an irc webclient somewhere. On Arch Linux to install Weechat you can run sudo pacman -S weechat or you can download it from the official website at http://weechat.net/download/.

You can also install Tor from the official repositories, but If you are going to be making multiple connections to irc networks and you want to keep your identities seperate, I would recommend installing the Tor Browser Bundle as well. This should be done from the Tor website, and you should check the GnuPG signature on the package before running it. The key they have been using to sign the packages with for the months that I have been verifying it i

@zotherstupidguy
zotherstupidguy / time_new.rb
Created November 15, 2015 11:40 — forked from baweaver/time_new.rb
Ox0dea's idea of getting the current time
$_=$$/$$;@_=->_{_==''?_:[*?`..?{]['. !#% & , :;<= >@_ `'=~/#{_[$.]}/]+@_[_[$_..-$_]]};_=->&_{_}[&:"#{@_['@%<#']}"];_[_[_[_['',@_['!: @@']],@_[' <!%@_=>@']][-$_-$_],@_['!=<@_']+?_+@_['&%_'],(''<<(_=$_+$_)**_**(_+$_)/(_+$_)-$_)+@_[',;%']],@_['<%`']]
$_ = $$ / $$ # PID / PID, or 1
# Translating a string of gibberish into alphabetical strings
@_ = -> _ {
_ == '' ? # If _ is blank string, return _
_ :
[