Skip to content

Instantly share code, notes, and snippets.

View JessicaGreben's full-sized avatar

Jessica G JessicaGreben

View GitHub Profile
@JessicaGreben
JessicaGreben / longest_concat_word.rb
Created February 28, 2017 19:47
Longest Concatenated Word algorithm
require 'trie'
class LongestConcatWord
def initialize(file)
@trie = Trie.new
@word_hash = Hash.new
@original_word = nil
@file = file
@concat_words = []
@count = 0
@JessicaGreben
JessicaGreben / anagramAndPalindrome.js
Created April 17, 2017 03:41
anagram and palindrome algorithms
// Problem 1 - Palindrome
// Write a function that takes a string as an input
// and returns true if the string is the same string forwards
// and backwards
String.prototype.reverse = function() {
return this.split("").reverse().join("");
}
const isPalindrome = function(str) {
@JessicaGreben
JessicaGreben / dockercleanup.md
Created November 10, 2017 17:45
docker container cleanup

docker system cleanup

docker system prune -a Check out deets here

remove dangling volumes:

docker volume rm $(docker volume ls -f dangling=true -q) Check out some additional info here

remove untagged images

docker rmi $(docker images | grep none | awk '{ print $3}')

Keybase proof

I hereby claim:

  • I am jessicagreben on github.
  • I am jessg (https://keybase.io/jessg) on keybase.
  • I have a public key ASDLj2rOEsgiyRt-zCbR7R8VERuHWl1JK6l2t2wsWL5thAo

To claim this, I am signing this object:

@JessicaGreben
JessicaGreben / nginx_prometheus_metrics.txt
Created July 22, 2018 01:02
Example list of nginx ingress controller prometheus metrics
$ curl <ip-of-nginx-ingress-controller-pod>:10254/metrics
# HELP cpu_seconds_total Cpu usage in seconds
# TYPE cpu_seconds_total counter
cpu_seconds_total 125.68
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 1.9937e-05
go_gc_duration_seconds{quantile="0.25"} 2.5599e-05
go_gc_duration_seconds{quantile="0.5"} 2.8249e-05
CREATE TABLE accounting_rollups (
id bigserial NOT NULL,
node_id bytea NOT NULL,
start_time timestamp with time zone NOT NULL,
put_total bigint NOT NULL,
get_total bigint NOT NULL,
get_audit_total bigint NOT NULL,
get_repair_total bigint NOT NULL,
put_repair_total bigint NOT NULL,
at_rest_total double precision NOT NULL,
@JessicaGreben
JessicaGreben / constraints_fk.sql
Last active January 7, 2020 19:23
Foreign key constraints for satellite.DB up to version 73, ref: https://github.com/storj/storj/blob/master/satellite/satellitedb/migrate.go#L93
ALTER TABLE ONLY public.api_keys
ADD CONSTRAINT api_keys_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY public.bucket_metainfos
ADD CONSTRAINT bucket_metainfos_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id);
ALTER TABLE ONLY public.stripecoinpayments_apply_balance_intents
ADD CONSTRAINT fk_transactions FOREIGN KEY (tx_id) REFERENCES public.coinpayments_transactions(id) ON DELETE CASCADE;
@JessicaGreben
JessicaGreben / metainfoschema.sql
Last active May 5, 2020 18:45
updated: 2020-05-05
CREATE TABLE pathdata (
fullpath bytea PRIMARY KEY,
metadata bytea NOT NULL
);
$ cockroach sql --url 'postgres://postgres:<PW>@us-central1-352.gcp-us-central1.cockroachlabs.cloud:26257/satellite?sslmode=verify-full&sslrootcert=us-central1-ca.crt' --execute "select node_id, session_id, session_start, oldest_query_start, age(clock_timestamp(), oldest_query_start::timestamptz), substring(active_queries,0,50) as query from [show sessions] where oldest_query_start is not null order by oldest_query_start asc limit 10;"
node_id | session_id | session_start | oldest_query_start | age | query
+---------+----------------------------------+----------------------------------+----------------------------------+-----------------+---------------------------------------------------+
1 | 15ea0c2329edfa000000000000000001 | 2020-01-15 11:32:44.513491+00:00 | 2020-01-15 12:59:16.03245+00:00 | 02:53:43.354511 | INSERT INTO used_serials(serial_number_id, storag
1 | 15ea0c232b4c65570000000000000001 | 2
@JessicaGreben
JessicaGreben / qsort.go
Last active January 22, 2020 06:56
a quicksort implementation with some tests
package main
func quicksort(input []int) {
if len(input) < 2 {
return
}
// pivot is a pointer to the last item in the input array
pivot := len(input) - 1