Skip to content

Instantly share code, notes, and snippets.

View mindscratch's full-sized avatar

Craig Wickesser mindscratch

View GitHub Profile
@mindscratch
mindscratch / pg_connections.sh
Created September 11, 2017 00:47
postgres connections
SELECT
pid, application_name, query, state, state_change
FROM pg_stat_activity
WHERE usename = CURRENT_USER
ORDER BY state_change desc;
@mindscratch
mindscratch / handler.go
Created August 10, 2017 20:38
golang file upload http handler
package http
import (
"fmt"
"io"
"io/ioutil"
gohttp "net/http"
"github.com/mindscratch/artifact-manager/core"
)
@mindscratch
mindscratch / example.html
Created July 28, 2017 19:23
angular component binding problem
<script>
angular.module('myapp')
.component("parent", {
bindings: {
childTemplateUrl: '@?'
}
})
.component("child", {
bindings: {
customTemplateUrl: '@?'
@mindscratch
mindscratch / handler_test.go
Created July 10, 2017 15:02
[golang] http handler test
package main
import (
“net/http”
“net/http/httptest”
“testing”
)
fun TestHandler(t *testing.T) {
req, err := http.NewRequest(
@mindscratch
mindscratch / app.json
Created June 6, 2017 10:31
marathon app config for gpu task
{
"id": "/test",
"cmd": null,
"cpus": 0.2,
"mem": 128,
"disk": 0,
"instances": 1,
"constraints": [["gpus", "LIKE", "enabled"]],
"container": {
"type": "MESOS",
@mindscratch
mindscratch / download.js
Created May 29, 2017 23:22
Download a file via the DOM
/* A function that performs a download via the DOM */
var download = function(model) {
var downloadEl = $document[0].createElement('a');
var id = model.id;
var fileName = model.filename;
downloadEl.setAttribute('href', 'API/documents/' + id + '/download');
downloadEl.setAttribute('download', fileName);
downloadEl.style.display = 'none';
document.body.appendChild(downloadEl);
downloadEl.click();
@mindscratch
mindscratch / notes.md
Created April 27, 2017 18:04
Debugging PHP Running in a Docker Container with XDebug and PHPStorm on macOS Sierra

I used docker compose to stand up MariaDB and Apache web server in containers.

xdebug

I'm using php7 with CentOS 7.2. I had to install "php70w-pecl-xdebug.x86_64". I also added the following the Dockerfile

RUN echo "xdebug.idekey = PHPSTORM" >> /etc/php.d/xdebug.ini &&
echo "xdebug.default_enable = 0" >> /etc/php.d/xdebug.ini &&
echo "xdebug.remote_enable = 1" >> /etc/php.d/xdebug.ini &&
echo "xdebug.remote_autostart = 0" >> /etc/php.d/xdebug.ini && \

@mindscratch
mindscratch / notes.md
Last active May 15, 2018 15:34
One Day Advanced Ultimate Go Notes

Still need to organize and cleanup.


  • pointers provide efficiency b/c we can reference things on heap, tradefoff is having to have GC
  • value symantics mean things use the stack, doesn't use heap
  • data segment - globals, literals
  • stack - go routine (2k per go routine)
$ terraform apply
var.do_token
Enter a value: <enter digital ocean token here>
digitalocean_droplet.web: Creating...
image: "" => "centos-7-2-x64"
ipv4_address: "" => "<computed>"
ipv4_address_private: "" => "<computed>"
ipv6_address: "" => "<computed>"
ipv6_address_private: "" => "<computed>"