What's the problem?
- Describe what you're trying to do (Not how you're doing it)
- Describe what you expected to see
- Describe what you're getting instead
# Hack for Capybara to use SSL connections using selenium. | |
# | |
### Usage: | |
# Require this from rails_helper.rb | |
# | |
### Steps to generate a SSL certificate on a Linux box: | |
# 0. Starting from 'Rails.root' | |
# 1. Generate private key. Type in some password. | |
# $ openssl genrsa -des3 -out private.key 4096 | |
# 2. Generate certificate sign request |
# Helper methods for writing migrations for concern specific things. | |
module ConcernHelper | |
# Returns an array of symbols containing the table names of all models | |
# including 'concern'. If a block is given, it's called for each table name. | |
# | |
# Example usage: | |
# class AddSomethingToAllFooables | |
# include ConcernHelper | |
# |
$ ruby --version | |
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] | |
$ ruby benchmark.rb | |
user system total real | |
RedCarpet 0.220000 0.000000 0.220000 ( 0.227063) | |
kramdown 52.250000 0.000000 52.250000 ( 52.328927) | |
marked.js 3.660000 0.020000 3.680000 ( 3.632203) | |
# Machine: |
# File.read is inherited from IO.read, which in turn allows the user to call out | |
# to the shell and thus might turn any call to {File.read} into a Remote Code | |
# Execution vulnerability. | |
# | |
# This is insane. So get rid of it. | |
class File | |
def self.read(path, *opt) | |
raise Errno::ENOENT, "Shell methods not allowed" if path.start_with? '|' | |
super | |
end |
#!/usr/bin/env ruby | |
# Ejabberd authentication back-end script in Ruby. | |
# Works with Ruby 2.2. | |
# Dependency: RestClient gem | |
root = File.realpath("#{File.dirname __FILE__}/..") | |
URL = 'http://URL_TO_YOUR/service' | |
LOG_FILE = "#{root}/log/ejabberd_auth_tool.log" |
diff --git a/defs/id.def b/defs/id.def | |
index e186725..b603fe6 100644 | |
--- a/defs/id.def | |
+++ b/defs/id.def | |
@@ -39,6 +39,7 @@ firstline, predefined = __LINE__+1, %[\ | |
bt | |
bt_locations | |
call | |
+ method | |
mesg |
What's the problem?
This code comes from my operating system project, written in Crystal. The target platform was AMD64, so that's why it uses 64-Bit integers all over the place. The whole thing isn't open (yet?), but I stopped working on it so..
Take what you want from it, however a short source description, e.g. using a in-source comment, to this gist or to me would be really neat :)
Copyright (c) 2017 Stefan Merettig
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
#!/usr/bin/env ruby | |
# A script to bulk change file associations. Intended for KDE, but might work | |
# with other XDG conforming software. Run it without arguments to see how to | |
# use it. Created by me out of frustration, so the code just works ;) | |
require "inifile" # gem install inifile | |
ASSOC_FILE = "#{ENV['HOME']}/.config/mimeapps.list" | |
ASSOC_FILE_BAK = "#{ASSOC_FILE}.bak" |