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 / server.rs
Last active March 20, 2022 04:35
Naive static file server in rust
use std::io::prelude::*;
use std::net::TcpListener;
use std::net::TcpStream;
mod app;
fn main() {
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
for stream in listener.incoming() {
let stream = stream.unwrap();
handle_connection(stream);
@codesections
codesections / actix-web.rs
Created December 20, 2018 22:03
Basic static file server with actix-web
extern crate actix_web;
use actix_web::{fs, server, App};
fn main() {
server::new(|| {
App::new()
.handler(
"/",
fs::StaticFiles::new("./public")
.unwrap()
@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;