Skip to content

Instantly share code, notes, and snippets.

View adrianpike's full-sized avatar

Adrian Pike adrianpike

View GitHub Profile
@adrianpike
adrianpike / ioctl.c
Created January 14, 2010 22:06
Manual control of a serial port's RTS & DTR lines
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
@adrianpike
adrianpike / sunny_graphite.rb
Created May 12, 2020 02:07
Ardexa Sunny Boy to Graphite
#!/usr/bin/env ruby
require 'socket'
require 'time'
$file = ARGV[0] || "opt/ardexa/sma/logs/{}/latest.csv"
puts "Streaming readings from #{$file}..."
sock = TCPSocket.new 'localhost', 2003
@adrianpike
adrianpike / ff.sh
Created July 3, 2018 22:13
Quick way to find a filename in the usual way you're wanting to find a filename :)
function find_filename() {
if [ "$1" != "" ]
then
find . -not -path '*/\.*' | grep -i $1
else
echo "Need a filename"
fi
}
alias ff=find_filename

Keybase proof

I hereby claim:

  • I am adrianpike on github.
  • I am adrianpike (https://keybase.io/adrianpike) on keybase.
  • I have a public key ASBP5KHHMa5rjc4RMAqTrRocTCxPhivxYiXrUqigzoavpAo

To claim this, I am signing this object:

counts: {
foo: {
a: 50
b: 60
}
bar: {
a: 6312
}
zulu:{
c: 21
foo = ['a','b','c']
bars = _.map(foo, function(obj) {
return 'a' + obj;
})
#### VS ####
bars = 'a' + obj for obj in foo
@adrianpike
adrianpike / mp.rb
Last active December 10, 2015 14:29
class MagicalPresenter < Draper::Base
extend ActiveModel::Naming
include ActiveModel::Conversion
attr_reader :changes
def initialize(model, opts = {})
@changes = {}
super(model)
end
= form_for(:artwork_tag, :url => "/artworks/#{@artwork.id}/tags/create", :html => { :method => :create, :class => 'form-horizontal' }, :remote => true) do |f|
.control-group
= f.hidden_field :artwork_id, :value => @artwork.id
= f.hidden_field :user_id, :value => current_user.id
= f.text_field :tag_name, :class => "input-medium"
= f.submit "Add Tag", :class => "btn btn-small btn-primary"
== Autonomous Striver with Hidden Strength ==
Your responses indicate a desire to overcome a persistent feeling of emptiness or dissatisfaction. You believe life should have more to offer, and fear you have somehow not achieved everything you deserve.
Your desire for legitimate respect and success has led to increasing anxiety. Consequently, you no longer exhibit some of the friendliness and openness for which you were once known.
Similarly, you fear being overly influenced by others. You are often fiercely independent, which sometimes leads to being resistant to the opinions of friends and relatives — even to the point of denying what you fear may actually be true.
This behavior stems from your wish to be regarded as an authority. It leads you to react strongly when you suspect you might be wrong. At times you feel that too much is being asked of you, and that you are not properly recognized for your efforts. This situation — be it fueled by others’ jealousy or negligence — adds to the stress in your life.
begin
raise Exception
rescue Exception => e
puts e.backtrace.join("\n")
end