Skip to content

Instantly share code, notes, and snippets.

View juliarose's full-sized avatar

Julia juliarose

  • United States
View GitHub Profile
@juliarose
juliarose / Cobol.cbl
Created April 20, 2024 00:39
A simple COBOL template without line numbers.
*Format lines:
* awk -i inplace '{printf("%04d00%s\n", NR, substr($0,7,120)) }' main.cbl
*Compile and run:
* cobc -x main.cbl && ./main
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
AUTHOR. Julia.
DATE-WRITTEN. 2024-04-19.
DATE-COMPILED. 2024-04-19.
REMARKS. This is a pretty good COBOL program.
@juliarose
juliarose / variables-and-operations.cbl
Last active April 16, 2024 17:55
Storing different variables and performing operations in COBOL.
000100*Condensed from 01-06 https://www.youtube.com/watch?v=m0HfCx1wg1g
000200*AAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBIIIIIIII
000300 IDENTIFICATION DIVISION.
000400 PROGRAM-ID. hello.
000500 AUTHOR. JULIA.
000600 DATE-WRITTEN. 2024-04-16.
000700 DATE-COMPILED. 2024-04-16.
000800 REMARKS. This is a pretty good COBOL program.
000900*
001000 ENVIRONMENT DIVISION.
@juliarose
juliarose / Cobol.cbl
Last active April 16, 2024 17:39
A simple COBOL template.
000100*AAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBIIIIIIII
000150*Format lines:
000151* awk -i inplace '{printf("%04d00%s\n", NR, substr($0,7,120)) }' main.cbl
000160*Compile and run:
000161* cobc -x main.cbl && ./main
000200 IDENTIFICATION DIVISION.
000400 PROGRAM-ID. hello.
000500 AUTHOR. JULIA.
000600 DATE-WRITTEN. 2024-04-14.
000700 DATE-COMPILED. 2024-04-14.
@juliarose
juliarose / addRefineds.js
Created April 5, 2024 19:47
Demonstrates one method of adding floating-point refined metal values in JavaScript.
// Source:
// https://github.com/Nicklason/node-tf2-currencies
const ONE_REF_SCRAP = 9;
// Convert a number in refined to scrap
function toScrap(refined) {
return Math.round(refined * ONE_REF_SCRAP);
}
// A possibly more efficient way to match pluralized strings case-insensitively.
// For example matching "burgers" and "burger" with fewer iterations.
// Untested
fn eq_ignore_ascii_case_with_tail(mut lhs: &str, rhs: &str, tail: char) -> bool {
let mut lhs_len = lhs.len();
let rhs_len = rhs.len();
if lhs_len == rhs_len + 1 && lhs.ends_with(tail) {
lhs = &lhs[..lhs_len - 1];
@juliarose
juliarose / iterators.js
Last active February 6, 2024 14:55
hello world in JavaScript
const Filtered = Symbol('Filtered');
const Break = Symbol('Break');
class CharIterator {
constructor(string) {
this.string = string;
this.index = 0;
}
use std::str::FromStr;
use std::marker::PhantomData;
use serde::de::{self, Visitor};
pub struct StringOrU32Visitor<T> {
marker: PhantomData<T>,
}
impl<T> StringOrU32Visitor<T> {
pub fn new() -> Self {
@juliarose
juliarose / postgres.commands.psql
Last active March 27, 2024 17:00
Postgres commands
# Connect remotely from command line
psql -h <REMOTE HOST> -p 5432 -U <DB_USER> <DB_NAME>
# USE database;
\c databasename;
# SHOW TABLES;
\dt;
# SHOW COLUMNS FROM tablename
@juliarose
juliarose / deletelogs.sh
Created March 10, 2023 12:28
Deletes all files matching ".log" in current directory
#!/bin/sh
find . -type f -name "*.log*" -delete
@juliarose
juliarose / standard-deviation.js
Created March 5, 2023 02:35
Calculates standard deviation
/**
* Gets the standard deviation from a set of numbers.
* @example
* const { mean, stdv } = getStandardDeviation([10, 10, 10, 10, 5]);
* console.log(mean); // 9
* console.log(stdv); // 2
* @param {[number]} numbers - An array of numbers.
* @returns Object containing `mean` and `stdv`.
*/
function getStandardDeviation(numbers) {