Skip to content

Instantly share code, notes, and snippets.

View dapicester's full-sized avatar

Paolo D'Apice dapicester

View GitHub Profile
@dapicester
dapicester / copy-ssh-id
Created July 8, 2015 01:40
Copy SSH identity
#!/bin/sh
# Append a key (passed as argument $1) to the ~/.ssh/authorized_keys
# file on a targed host.
DOT_SSH=".ssh"
AUTHORIZED_KEYS="$DOT_SSH/authorized_keys"
if [ ! -e $DOT_SSH ]; then
mkdir $DOT_SSH
@dapicester
dapicester / concept.rb
Created July 29, 2015 08:12
ActiveRecord and ActiveNode
class Concept
include Neo4j::ActiveNode
property :name
def references
Reference.where(concept_uuid: uuid)
end
end
# example: Concept.first.references
@dapicester
dapicester / config.ru
Created June 6, 2016 02:23
Rack fallback for maintenance
require_relative 'offline'
run Sinatra::Application
@dapicester
dapicester / store_page_on_session
Created June 14, 2016 09:43 — forked from CootCraig/store_page_on_session
storing page on session for will_paginate
class ApplicationController < ActionController::Base
...
before_filter :page_params, :only => :index
def page_key
(self.class.to_s + "_page").to_sym
end
# Use a before_filter on index action to remember the current page
require 'arduino_firmata'
ArduinoFirmata.connect ARGV.shift, bps: 9600 do
puts "firmata version #{version}"
reset # This line did the trick!
puts "led on ..."
digital_write 13, true
sleep 1
@dapicester
dapicester / .projections.json
Last active August 7, 2017 07:40
Projections for Django projects
{
"*/apps.py": {
"type": "app"
},
"*/urls.py": {
"type": "urls"
},
"*/utils.py": {
import React from 'react'
import { isEqual, template } from 'lodash'
// This is a DOM library, some plumbing with refs is required.
import 'json-editor'
// Get the imported reference from the global namespace.
const JSONEditor = window.JSONEditor
// Set sensible defaults
#!/bin/sh
# Adapted from bundled bin/dia script
CWD="/Applications/Dia.app/Contents/Resources/bin"
TOP="`dirname \"$CWD\"`"
export DISPLAY=:0
export LANG="en_US.UTF-8"
@dapicester
dapicester / gist:19c0f0fc63b090d430fed6a15e2eaf52
Created July 29, 2019 14:18
Find raspberry pi on local network
arp -a | grep b8:27:eb
@dapicester
dapicester / howto.md
Last active August 4, 2019 06:10
ShadowSocksR linux

How to set up:

git clone --branch akkariiin/master https://github.com/shadowsocksrr/shadowsocksr.git
cd shadowsocksr
bash initcfg.sh

Edit the configurations:

$EDITOR user-config.json