Skip to content

Instantly share code, notes, and snippets.

View desnudopenguino's full-sized avatar

Adam "Bucky" Townsend desnudopenguino

View GitHub Profile
@desnudopenguino
desnudopenguino / dateFinder
Last active August 29, 2015 14:06
Calculates the overlapping sums of a range of numbers (used for dates in a project)
#!/bin/php
<?php
function test($array) {
$start = 0;
$end = 0;
$total = 0;
foreach( $array as $index => $time) {
if($start == 0 AND $end == 0) {
$start = $time['start'];
$end = $time['end'];
@desnudopenguino
desnudopenguino / Install Rails on OpenBSD 5.9
Last active December 20, 2018 13:43
Setting up rails on OpenBSD 5.9
1. Install Ruby
pkg_add ruby
- I chose 2.3.0
2. Install gems
pkg_add ruby-gems
3. Add ~/.gem/ruby/2.3/bin to PATH
PATH="~/.gem/ruby/2.3/bin:"$PATH
4. Install bundle
gem23 install --user-install bundler
5. Install nokogiri (or run into problems installing rails)
I'm attempting to set up an OpenBSD OpenBazaar node (and document the setup for repeatability).
Docs can be found here: https://github.com/OpenBazaar/OpenBazaar-Server, https://slack-files.com/T02FPGBKB-F0KJU1CLX-cbbcf8a02c
Current hang-up: It looks like the openbazaar-server needs docker. I don't want to run such a thing and can't (in openbsd).
gcc -DHAVE_CONFIG_H -I. -I/usr/local/include/postgresql -Wall -g -MT m_openbsd.o -MD -MP -MF .deps/m_openbsd.Tpo -c -o m_openbsd.o `test -f 'machine/m_openbsd.c' || echo './'`machine/m_openbsd.c
machine/m_openbsd.c: In function 'get_system_info':
machine/m_openbsd.c:226: error: storage size of 'vmtotal' isn't known
machine/m_openbsd.c:239: warning: suggest explicit braces to avoid ambiguous 'else'
machine/m_openbsd.c:226: warning: unused variable 'vmtotal'
*** Error 1 in . (Makefile:617 'm_openbsd.o')
*** Error 1 in /home/bucky/pg_top-3.7.0 (Makefile:270 'all')
@desnudopenguino
desnudopenguino / Recursive SQL for Triggers
Last active October 5, 2016 00:59
Recursively iterate through trigger tree options
/**
* get_joined_meta - Recursively gets and builds a JSON compatible array of all of the selected trigger options to dynamically build trigger events
*
* @param string $meta_id: The string for checking the meta_id of the trigger. Default: "is null"
*
* @returns array: The compiled list of nested options for a trigger meta item in JSON format.
*/
public function get_joined_meta($meta_id = "is null")
{
/** get the global db connection */
@desnudopenguino
desnudopenguino / Install Bitcoin on OpenBSD 6.0
Last active January 3, 2018 20:43
Building/Installing Bitcoin on OpenBSD
0. Make sure some dependencies are installed!
automake (1.15), autoconf (2.69), git, libtool, berkleydb (installed from source 4.8), boost, protobuf, python > 3.5, gmake, leveldb
5.9 guide: https://github.com/bitcoin/bitcoin/blob/master/doc/build-openbsd.md
1. Clone the repo
git clone https://github.com/bitcoin/bitcoin.git
2. Checkout newest stable branch (0.13.0 currently)
git checkout v0.13.0
3. run autogen script
./autogen.sh
Error: Provide an AUTOCONF_VERSION environment variable, please.
@desnudopenguino
desnudopenguino / round 2
Last active November 25, 2016 20:01
Error when running make (test) after installing OpenBazaar
bucky@hal:~/openbazaar_test/OpenBazaar-Server$ make [191/191]
./scripts/pycheck.sh
/usr/local/bin/pylint
.: Checking python source files...
find: -not: unknown option
PASS: Successfully checked 0 files.
nosetests -vs --with-doctest --with-coverage --cover-package=dht --cover-package=db --cover-package
=market --cover-inclusive ./dht/tests ./db/tests ./market/tests
Failure: AttributeError ('NoneType' object has no attribute 'endswith') ... ERROR
test_getNoneNodeById ... ok
@desnudopenguino
desnudopenguino / Xorg.0.log
Last active August 19, 2017 17:26
Error(s) when running startx in OpenBSD 6.0 on a Lenovo 11e AMD A4-6210 with integrated R3 gfx with fw_update run
[ 26.876] (--) checkDevMem: using aperture driver /dev/xf86
[ 26.889] (--) Using wscons driver on /dev/ttyC4
[ 26.898]
X.Org X Server 1.18.3
Release Date: 2016-04-04
[ 26.898] X Protocol Version 11, Revision 0
[ 26.898] Build Operating System: OpenBSD 6.0 amd64
[ 26.898] Current Operating System: OpenBSD 11e.my.domain 6.0 GENERIC.MP#2319 amd64
[ 26.898] Build Date: 26 July 2016 01:23:40PM
[ 26.898]
@desnudopenguino
desnudopenguino / common.py
Created March 26, 2017 02:08
libtmux hack fix to use it in OpenBSD's tmux (libtmux/common.py)
" Starting at line 401
403 " OpenBSD doesn't use -V, so make sure it is > 5.8 "
1 import platfor9
2 os = platform.system()
3 rel = platform.release()
4
5 if not version:
6 proc = tmux_cmd('-V')
7 " OpenBSD hack "
8 if os != 'OpenBSD' and float(rel) <= 5.9:·
@desnudopenguino
desnudopenguino / _address.html.erb
Last active May 26, 2017 04:07
Contact and Address saving with Rails 5
<% prefix = "contact_address" %>
<%= fields_for prefix, @address do |address_form| -%>
<div class="field">
<%= address_form.label :name %>
<%= address_form.text_field :name, id: :address_name %>
</div>
<div class="field">
<%= address_form.label :street %>
<%= address_form.text_field :street, id: :address_street %>