If you have error in console
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Regenerate locales:
locale-gen en_US.UTF-8
my_array = %w[test one two three] | |
# Inject takes the value of the block and passes it along | |
# This often causes un-intended errors | |
my_array.inject({}) do |transformed, word| | |
puts transformed | |
transformed[word] = word.capitalize | |
end | |
# Output: | |
# {} |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev curl zlib1g-dev | |
curl -L https://get.rvm.io | bash -s stable | |
source ~/.rvm/scripts/rvm | |
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc | |
source ~/.bashrc | |
rvm install 2.1.6 |
#!/usr/bin/env ruby | |
# gem install ruby-rc4 | |
require "rc4" | |
dir = ARGV[0] | |
key = "\x5E\xAE\x45\xB3\x77\xE7\x9C\x36\x9B\x1D\xB4\x4E\xD6\x4F\xE1\x1F" | |
rb_files = Dir.glob("#{dir}/**/*.rb") | |
puts "Begin decrypting..\n" |
#!/usr/bin/env ruby | |
require "addressable/uri" | |
require 'nokogiri' | |
require 'string_monkey_path' | |
def item_field_by_name(item, name) | |
item.css(name).first.children.map(&:to_s).first || "" | |
end |
class String | |
def is_number? | |
true if Float(self) rescue false | |
end | |
def includes?(ary) | |
ary.each do |el| | |
return true if self.include?(el) | |
end | |
false |
BEGIN; | |
LOCK TABLE netscanner_host_statistics IN SHARE ROW EXCLUSIVE MODE; | |
WITH upsert AS (UPDATE netscanner_host_statistics SET count_of_hosts = count_of_hosts + 1, updated_at = now() WHERE (netscanner_host_statistics.name = 'ya.ru' AND netscanner_host_statistics.workspace_id = 1) RETURNING *) INSERT INTO netscanner_host_statistics (name, workspace_id, count_of_hosts, created_at, updated_at) SELECT 'ya.ru', 1, now(), now() WHERE NOT EXISTS (SELECT * FROM upsert); | |
INSERT INTO netscanner_hosts_host_statistics (host_id, host_statistic_id) VALUES (398, ?) | |
COMMIT; |
DO $$ | |
DECLARE lastid bigint; | |
BEGIN | |
LOCK TABLE netscanner_host_statistics IN SHARE ROW EXCLUSIVE MODE; | |
SELECT id INTO lastid FROM netscanner_host_statistics WHERE name = 'ya.ru' AND workspace_id = 1; | |
IF NOT FOUND THEN | |
INSERT INTO netscanner_host_statistics (name, workspace_id, count_of_hosts, created_at, updated_at) VALUES ('ya.ru', 1, 1, now(), now()) RETURNING id INTO lastid; | |
ELSE |
#!/usr/bin/env ruby | |
class String | |
def includes?(ary) | |
ary.each { |el| return true if self.include?(el) } | |
false | |
end | |
end | |
PATTERN = %r{\*.(?<key>\w+)\s+:\s+(?<value>.*)} | |
ACCEPTED = %w(msv wdigest) |
import React from "react"; | |
import Table from "material-ui"; | |
// import Router from "react-router"; | |
// let Link = Router.Link; | |
let WorkspacesTable = React.createClass({ | |
mixins: [], | |
propTypes: { |