Skip to content

Instantly share code, notes, and snippets.

View codesections's full-sized avatar

Daniel Sockwell codesections

View GitHub Profile
@codesections
codesections / pass-new.sh
Created June 1, 2018 16:22
Simple shell script to use hsxkpasswd with pass
#!/bin/bash
NEWPASSWORD=$(hsxkpasswd)
if [[ $1 ]]; then
echo -e "$NEWPASSWORD\n$NEWPASSWORD" | pass insert $1
else
echo "Usage: pass-new <pass-name>"
fi

Keybase proof

I hereby claim:

  • I am codesections on github.
  • I am codesections (https://keybase.io/codesections) on keybase.
  • I have a public key whose fingerprint is 7303 E046 50F8 CCA0 4F66 EA6E 25B6 4501 3B50 8835

To claim this, I am signing this object:

@codesections
codesections / reviews47.js
Created November 1, 2018 03:42
CURL API response filtered through jq for pretty printing
curl 'http://localhost:8000/reviews/47' | jq .
[
{
"id": 382,
"product_id": 47,
"rating": 3,
"reviewer": "Bridgette_Bogisich",
"title": "Vel vel doloremque ad deleniti quis magnam voluptates eos consequuntur.",
"body": "Nemo nostrum veritatis sapiente at recusandae sed facilis dolore. Voluptatem corrupti laborum vel tenetur. Voluptatem ut veritatis ex necessitatibus velit at qui. Officia dolor rerum rerum quis quis tempora esse consequatur qui. Sed et recusandae distinctio voluptatum. Et cum unde distinctio cum.",
@codesections
codesections / TestFolder.md
Created November 3, 2018 03:41
Current tests for trailblazers/reviews

The instruction state that we should link to our test folder, but I don't have a test folder—I followed advice to keep all tests directly next to the file that they're testing. So, for example, my /server/ folder has an app.js file and an app.test.js file.

Since I don't have a single folder with all my tests, here are links to my test files (roughly in declining order of significance):

/client/src/app.test.js

/server/app.test.js

/server/db/db.config.test.js

@codesections
codesections / Core DB query
Last active November 26, 2018 14:28
A database query for MariaDB
SELECT * from myTable WHERE listingId = 9000008;
Results
=======
+-----------+----------+----------------------------------------------------------------+---------+-----------------------------------------------------------------+
| listingId | id | alt | photoId | title |
+-----------+----------+----------------------------------------------------------------+---------+-----------------------------------------------------------------+
| 9000008 | 90883922 | Numquam adipisci et ea illo commodi. | 517 | Soluta laudantium harum veritatis totam at sint. |
I am using the Lynx npm package to pass data to Telegraph. It bundles the data and passes it on to InfluxDB
(a time-series database) which makes the data avalible to Grafana.
I use this process to monitor load testing performed with K6. As reflected in the screenshot below, this has allowed me to
measure requests/second at ~20k.
I am using the Lynx npm package to pass data to Telegraph. It bundles the data and passes it on to InfluxDB
(a time-series database) which makes the data avalible to Grafana.
I use this process to monitor load testing performed with K6. As reflected in the screenshot below, this has allowed me to
measure requests/second at ~20k.
@codesections
codesections / nginx.conf
Created December 21, 2018 14:16
Simple nginx config for static site
user root;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@codesections
codesections / main.rs
Created December 23, 2018 15:57
Linked List with a struct
struct LinkedList {
value: u8,
next: Option<Box<LinkedList>>,
}
impl LinkedList {
fn new(value: u8) -> LinkedList {
LinkedList { value, next: None }
}
@codesections
codesections / robotPaths.js
Created January 8, 2019 19:59
A javascript solution to a simple practice problem
/**
*
* A robot located at the top left corner of a 5x5 grid is trying to reach the
* bottom right corner. The robot can move either up, down, left, or right,
* but cannot visit the same spot twice. How many possible unique paths are
* there to the bottom right corner?
*
* make your solution work for a grid of any size.
*
*/