Skip to content

Instantly share code, notes, and snippets.

View codesections's full-sized avatar

Daniel Sockwell codesections

View GitHub Profile
@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 / 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 / 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 / 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);
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 / 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. |
@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 / 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.",

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: