Skip to content

Instantly share code, notes, and snippets.

View wankdanker's full-sized avatar

Dan VerWeire wankdanker

View GitHub Profile
@wankdanker
wankdanker / happend.js
Last active September 26, 2022 12:01
happend LUA script for redis
const Redis = require('ioredis')
const redis = new Redis()
redis.defineCommand("happend", {
numberOfKeys: 2,
lua: `
local current = redis.call("hget", KEYS[1], KEYS[2])
if current == nil or current == false then
current = ARGV[1]
else
@wankdanker
wankdanker / mkunpriv.sh
Last active December 26, 2023 19:43
A script to make Proxmox LXC Containers unprivileged
#!/bin/bash
##
## Warning: do not use this unless you understand and agree with what it does
##
## Based on: https://forum.proxmox.com/threads/convert-privileged-to-unprivileged-container.31066/#post-261883
##
## NOT HANDLED
## * multiple disks
## * if there are backup/snapshot references in the lxc/$vmid.conf the unprivileged:1 will be added to the end of the file and in a backup config not in the active config, that can break the first boot
## * setuid and setgid permissions are not retained
@wankdanker
wankdanker / README.md
Last active October 31, 2019 14:05
Walmart Drop Ship Vendor Supplier DSV Carrier Method Codes

Walmart Drop Ship Vendor Supplier DSV Carrier Method Codes

As part of the Walmart DSV API, there are carrier method codes in the order xml, but the only documentation I found was in this PDF. That document is referenced from Supplier Help.

That PDF file is of course not easily consumable and it was a wicked pain in the ass to get the data out of there. But, it's done now, and if you happen to find this file I hope I saved you some time.

@wankdanker
wankdanker / README.md
Last active December 14, 2015 16:38
Generate a mac address based on FQDN

Install

curl https://gist.githubusercontent.com/wankdanker/2f676cc85f52fd471567/raw -o /usr/local/bin/gen-mac; chmod 755 /usr/local/bin/gen-mac
@wankdanker
wankdanker / install.md
Last active August 29, 2015 14:19
Installing kdev-qmljs (JavaScript/Nodejs Code Completion) for kdevelop on Ubuntu 14.04

This is what I had to do in order to get code completion for node.js to work with kdevelop on Ubuntu 14.04.

I have not run through these steps again on a fresh system so, I'm not sure if I'm missing anything here. If you find something missing please let me know.

#enable the backports repository to get kdevelop 4.7
sudo apt-add-repository ppa:kubuntu-ppa/backports
sudo apt-get update

#you may be able to skip this step if you want, but I did it.
make: Entering directory `/home/dverweire/projects/node/node-odbc/build'
CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
../src/odbc.cpp: In static member function ‘static void ODBC::Init(v8::Handle<v8::Object>)’:
../src/odbc.cpp:65:16: warning: unused variable ‘isolate’ [-Wunused-variable]
v8::Isolate* isolate = v8::Isolate::GetCurrent();
../node_modules/nan/nan_new.h: In instantiation of ‘typename NanIntern::Factory<T>::return_t NanNew(A0) [with T = v8::Integer; A0 = long int; typename NanIntern::Factory<T>::return_t = v8::Local<v8::Integer>]’:
../src/odbc.cpp:386:18: required from here
../node_modules/nan/nan_new.h:209:41: error: call of overloaded ‘New(long int&)’ is ambiguous
return NanIntern::Factory<T>::New(arg0);
^

/etc/ld.so.conf.d/psql.conf

#pervasive sql libraries
/usr/local/psql/lib/

Then issue sudo ldconfig

@wankdanker
wankdanker / readstuff.js
Created November 16, 2012 23:56
for xp_prg
var prompt = require('prompt');
var result2 = [];
//not sure what this does so don't know when it should be called.
prompt.start();
function getData() {
prompt.get(['username', 'email'], function (err, result) {
if (err) { return onErr(err); }
console.log('Command-line input received:');
@wankdanker
wankdanker / binding.gyp
Created October 4, 2012 18:13
uv_queue_work question
{
'targets' : [
{
'target_name' : 'modulename',
'sources' : [
'modulename.cpp'
]
}
]
}
@wankdanker
wankdanker / odbc-bench.c
Created April 16, 2012 20:57
benchmark minimal query using raw odbc
/*
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN