Skip to content

Instantly share code, notes, and snippets.

Avatar
🥬

Arvid E. Picciani aep

🥬
View GitHub Profile
View gist:9707722
puts params
params.require(:region).permit(:beacons)
---> output
{"region"=>{"beacons"=>[{"minor"=>123, "uuid"=>"123-123-123-123", "major"=>123}]}, "action"=>"create", "controller"=>"regions"}
Unpermitted parameters: beacons
View gist:9725938
after_action :verify_authorized
# DELETE /applications/1
# DELETE /applications/1.json
def destroy
@app.destroy
respond_to do |format|
format.html { redirect_to apps_url }
View gist:9765382
class User < ActiveRecord::Base
belongs_to :app
before_create :make_token
protected
def make_token
View gist:9765344
aep@nightbringer: ~/proj/airbacon/airbeacon rails console
Loading development environment (Rails 4.0.2)
irb(main):001:0> User.create(app_id:123).token
(39.9ms) BEGIN
+++++++++++MAKING TOKEN!
SQL (125.5ms) INSERT INTO "users" ("app_id", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["app_id", 123], ["created_at", Tue, 25 Mar 2014 16:16:57 UTC +00:00], ["updated_at", Tue, 25 Mar 2014 16:16:57 UTC +00:00]]
(42.2ms) COMMIT
=> nil
irb(main):002:0>
View gist:10133550
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.npPdTT
+ umask 022
+ cd ./
+ cd /
+ rm -rf ruby-2.0.0-p451
+ /usr/bin/gzip -dc /tmp/rpmb/rpmbuild/SOURCES/ruby-2.0.0-p451.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd ruby-2.0.0-p451
View client.conf
# basic configuration
config setup
# nat_traversal=yes
# Connections into AWS VPC
conn %default
ikelifetime=60m
keylife=20m
View client.conf
#2.2.2.2 PUBLIC SERVER IP
#1.1.1.1 PRIVATE SERVER IP
#192.168.1.130 CLIENT IP BEHIND NAT
# ipsec.conf - strongSwan IPsec configuration file
# basic configuration
config setup
# plutodebug=all
View gist:cf26c59f8dd2caf4f856
ActiveAdmin.register Foo
show do |b|
panel "Bar" do
table_for [0] do
column :api do
e+= (controller.render_to_string :partial => "status", :locals => {:status =>
VpnConnection.is_ap_connected(b.endpoint, b) ? :up : :down })
e+= b.name
e
View onboarding_controller.rb
module Portal::V2
class OnboardingController < PortalController
skip_filter :enforce_user_session!, only: [:index, :debug]
def index
# we never get here
end
end
end
View gist:f0e7281d576c2ea318e5
require 'middleman/rack'
def ratelimit
return false
end
class XNS
def call(env)
ratelimit(env) or return