###Moving one repo into a subdirectory of the other
Preserves notes and sets commit details to author details
in newrepo
defmodule Phtest.OrientConnector do | |
use Jazz | |
@base_url "http://localhost:2480/" | |
@database "Phtest" | |
@user "admin" | |
@password "admin" | |
@basic_auth [basic_auth: {@user, @password}] | |
def get(document_id, type) do | |
OrientConnector.get_document(document_id) |
AllCops: | |
RunRailsCops: true | |
# Commonly used screens these days easily fit more than 80 characters. | |
Metrics/LineLength: | |
Max: 120 | |
# Too short methods lead to extraction of single-use methods, which can make | |
# the code easier to read (by naming things), but can also clutter the class | |
Metrics/MethodLength: |
from scapy.all import * | |
def arp_display(pkt): | |
if pkt[ARP].op == 1: #who-has (request) | |
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe | |
print "ARP Probe from: " + pkt[ARP].hwsrc | |
print sniff(prn=arp_display, filter="arp", store=0, count=10) | |
Salvaged from Google Cache of http://www.lps-it.fr/blog/20151218-signal-handling-and-ruby.html
December 18, 2015
Linux Ruby
Since version 2.0.0, signal handling in Ruby can be tricky. I bet if you're here, it's because you've seen this error message :
#!/usr/bin/env ruby | |
# bundler exec ruby gems_homepages.rb | |
# based on http://stackoverflow.com/questions/5177634/list-of-installed-gems | |
require 'rubygems' | |
def local_gems | |
Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name } | |
end | |
puts local_gems.map{ |name, specs| |
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
# Mina Deploy | |
# =========== | |
# | |
# Adapted from Creative deploy stack in Manabalss v4, Mar.2015, updated to support staging on Jun.2015 | |
# On first deploy do: mina setup --verbose | |
# Then do : mina deploy[initialize] --trace | |
# | |
# Usage examples: | |
# mina deploy[soft,seed,compile] to=staging # deploy task with all options | a simple `mina deploy` will deploy to production | |
# mina rake[db:seed] # for multi-argument tasks # mina 'rake[payments:refund[arg1\,arg2]]' |
Overview | |
-------- | |
Consider the commands given to be examples, not to necessarily be precisely | |
what you will use. They were based on my circumstances, in which | |
* my local platform is macOS, | |
* where Homebrew is the de facto package manager; | |
* my laptop (and the server) are managing Ruby with rbenv; | |
* vim is my remote editor of choice, and an acceptable local editor; and |
The credentials are stored in the "credentials.yml.enc" file, encrypted. | |
To decrypt the credentials file, you need a master key that is set on either: | |
* config/master.key file (for local development) | |
* ENV["RAILS_MASTER_KEY"] (for deployed environments) | |
What should you commit? | |
* The file config/master.key should be ignored in gitignore (you should not commit the master key) | |
* The file credentials.yml.enc should be commited along with the codebase (but don't worry, only those who have the master key can decrypt it) |