Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile
<%= csrf_meta_tag %>
<script type="text/javascript">
$(function() {
var csrf_token = $('meta[name="csrf-token"]').attr('content');
$("body").bind("ajaxSend", function(elm, xhr, s){
if (s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Token', csrf_token);
}
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]

Typographic glyphs

via

Shortcuts and proper use

name glyph mac other description
curly single quotes ‘ ’ Option+] and Shift+Option+] ALT-0145 and ALT-0146 hover for description
curly double quotes “ ” Option+[ and Shift+Option+[ ALT-0147 and ALT-0148 -

Combined test from freevps.us

wget freevps.us/downloads/bench.sh -O - -o /dev/null|bash

ioping classic commands:

ioping . -c 10

ioping -RL /
it "should do something" do
@user = Factory(:user)
begin
@item.user = @user
@item.save
rescue Exception => e
binding.pry
raise e
/* ::Scrollbar and browser elements styles */
/* ------------------------------------------------------------ */
::selection, ::-moz-selection {
background: $color_ruby_red;
color: #fff;
}
::-webkit-scrollbar {
-webkit-appearance: none;

CVE-2013-3221 Outline / Work Arounds / Fixes / Credits

original link

Common patterns used in Ruby on Rails applications could allow an attacker to generate SQL that, when combined with some database server's typecasting code, generates queries that match incorrect records.

Note: This is a code and best-practise advisory, there is no patch to

#!/usr/bin/env ruby
#------------------------------------------------------------------------------
# Aggregate Print useful information from /proc/[pid]/smaps
#
# pss - Roughly the amount of memory that is "really" being used by the pid
# swap - Amount of swap this process is currently using
#
# Reference:
# http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt#361