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'];
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')
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).
@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 / 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 / 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 %>
$ ranger --debug
ranger version: 1.7.2, executed with python 2.7.13
Locale: en_US.UTF-8
Current file: /home/bucky/.backgrounds/2U9ysiA.jpg
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/ranger/core/main.py", line 140, in main
fm.loop()
File "/usr/local/lib/python2.7/site-packages/ranger/core/fm.py", line 342, in loop
ui.draw_images()
File "/usr/local/lib/python2.7/site-packages/ranger/gui/ui.py", line 323, in draw_images
@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 / vultr_openbsd.tf
Last active November 4, 2017 08:53
A sample config to set up openbsd on vultr
// Configure the Vultr provider.·
// Alternatively, export the API key as an environment variable: `export VULTR_API_KEY=<your-vultr-api-key>`.
provider "vultr" {
api_key = "<api key>"
}
// Find the ID of the Silicon Valley region.
data "vultr_region" "seattle" {
filter {
name = "name"