Skip to content

Instantly share code, notes, and snippets.

View connorworley's full-sized avatar

Connor Worley connorworley

View GitHub Profile
@connorworley
connorworley / cpp_cheatsheet.md
Last active February 2, 2021 10:17
C++ Cheatsheet

C++ Cheatsheet

Declarations

Declarations are a way of telling the compiler what the type of a name is. Names must be declared before they can be used. Declarations consist of a type followed by a name.

int numberOfApples;
// numberOfApples is an integer
std::string myName;
// myName is a string
from pathlib import Path
import onshape_client
from onshape_client.oas.models.bt_translate_format_params import BTTranslateFormatParams
from onshape_client.onshape_url import OnshapeElement
def main():
def open_authorize_grant_callback(authorization_url, fetch_token):
print(f"Open the following URL in your browser: {authorization_url}")
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
use std::ffi::CString;
mod NiFpga {
use std::fmt;
use std::os::raw::c_char;
pub type Session = u32;
#[derive(PartialEq, Eq)]
#[repr(C)]
#pragma once
#include <type_traits>
/* template-arg compatable absolute function */
constexpr inline double abs(double x) {
return (x > 0.0) ? x : -x;
}
/**
* C++ doesn't support floating point non-type template arguments so
#!/bin/bash
api_key="redacted"
screenshot_dir=$(defaults read com.apple.screencapture location)
if [[ -z $(command -v fswatch) ]]; then
echo "Could not find fswatch, exiting"
exit
fi
#!/bin/zsh
declare -A visited_formulas
check_formulas() {
for formula in "$@"; do
if [[ -z `brew uses --installed $formula` ]] && ! (( ${+visited_formulas[$formula]} )) && [[ $formula != "brew-cask" ]]; then
read "input?$formula is not depended on by other formulas. Remove? [Y/n] "
visited_formulas[$formula]=1
if [[ "$input" == "Y" ]]; then