Skip to content

Instantly share code, notes, and snippets.

View ajbeach2's full-sized avatar
🏖️
skrrt skrrt

Alex ajbeach2

🏖️
skrrt skrrt
View GitHub Profile
@ajbeach2
ajbeach2 / prompt.sh
Created February 1, 2021 22:05
PS1 Prompt
PS1='💻:\[\033[01;34m\]\W\[\033[00m\]$(__git_ps1)-> '
class Solution {
public:
void sortColors(vector<int>& nums) {
int arr[] ={0,0,0};
for(int i = 0; i < nums.size(); i++)
arr[nums[i]]++;
int next = 0;
for(int i = 0; i < nums.size(); i++){
while(arr[next] > 0){
nums[i] = next;
@ajbeach2
ajbeach2 / ray_trace_postgres.sql
Last active October 11, 2019 15:10
ray_trace_postgres.sql
-- ported to postgres from https://observablehq.com/@pallada-92/sql-3d-engine
WITH RECURSIVE numbers AS (
SELECT 0 AS n UNION ALL SELECT n+1 FROM numbers WHERE n<89
),
pixels AS (
SELECT rows.n as row, cols.n as col
FROM numbers as rows CROSS JOIN numbers as cols
WHERE rows.n > 2 AND rows.n < 40 AND cols.n > -1 AND cols.n < 89
), rawRays AS (
SELECT
@ajbeach2
ajbeach2 / cloudwatch.go
Created May 14, 2019 12:17
Cloudwatch Metric Example Golang
params := &cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{
{
MetricName: aws.String(name),
Dimensions: []*cloudwatch.Dimension{
{
Name: aws.String("HandlerMetrics"),
Value: aws.String(w.Name),
},
},
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func downloadFile(filepath string, url string) (err error) {
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ern="http://ddex.net/xml/ern/41" xmlns:avs="http://ddex.net/xml/avs/avs"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://ddex.net/xml/ern/41" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://ddex.net/xml/avs/avs" schemaLocation="avs4.xsd"/>
<xs:annotation>
<xs:documentation>© 2006-2018 Digital Data Exchange, LLC (DDEX)</xs:documentation>
<xs:documentation>This XML Schema Definition file is, together with all DDEX standards, subject to two licences: If you wish to evaluate whether the standard meets your needs please have a look at the Evaluation Licence at https://kb.ddex.net/display/HBK/Evaluation+Licence+for+DDEX+Standards. If you want to implement and use this DDEX standard, please take out an Implementation Licence. For details please go to http://ddex.net/apply-ddex-implementation-licence.</xs:documentation>

Keybase proof

I hereby claim:

  • I am ajbeach2 on github.
  • I am ajbeach2 (https://keybase.io/ajbeach2) on keybase.
  • I have a public key ASCe86GUux_9rkQtdcmQC7XsLwX-Og1eC37sFWoGeNlxWwo

To claim this, I am signing this object:

version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.3
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
services:
client:
build: ./myclient
volumes:
- ./myclient/:myclient
- ./myclient/node_modules:/myclient/node_modules
ports:
- "8080"
web:
build: ./myapi
@ajbeach2
ajbeach2 / nested-redis.rb
Created September 27, 2015 20:51 — forked from Loupi/nested-redis.rb
Redis Nested Comments in Ruby
require 'redis'
require 'json'
class CommentsRepository
def initialize
@redis = Redis.new
end
def save(itemId, comment, parentId = nil)