Skip to content

Instantly share code, notes, and snippets.

View Adobe-Android's full-sized avatar

David Brown Adobe-Android

View GitHub Profile
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var getterPropInstance = new GetterAutoProp();
Console.WriteLine(getterPropInstance.RandomInt);
@Adobe-Android
Adobe-Android / fish_check_interactive_shell.sh
Last active April 23, 2021 21:19
A fish shell script to check if running in an interactive shell
#!/bin/fish
if status --is-interactive
echo an interactive shell
else
echo not an interactive shell
end
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
~!@#$%^&*()[]{}<>_+-=,.:;?/\|'"
0123456789
@Adobe-Android
Adobe-Android / top_bash_commands.sh
Last active April 23, 2021 19:44
A simple way to check your most frequently used Linux commands
#!/bin/bash
# Reads from specified shell history file.
HISTFILE=~/.bash_history
# Enable history. Disabled by default in a non-interactive shell (e.g. scripts like this).
# Uses awk to get just the command name from shell history, sorts list by command name, filters out non-unique data, sorts by frequency, grabs top 5.
set -o history
history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5
@Adobe-Android
Adobe-Android / .vimrc
Last active March 8, 2021 18:20
Minimal .vimrc
set nocompatible " disable vi compatibility
syntax on " enable syntax highlighting
set background=dark " dark or light. used to help inform syntax highlighting colors
set number " enable line numbers
"
" configure tab width and insert spaces instead of tabs
" https://stackoverflow.com/questions/1562336/tab-vs-space-preferences-in-vim
"
set expandtab " expand tabs to spaces
set tabstop=2 " set tab width to 2 spaces
@Adobe-Android
Adobe-Android / pi.cpp
Created November 20, 2020 05:58
Takes advantage of the C++20 mathematical constants in the new <numbers> header
#include <iomanip>
#include <iostream>
#include <numbers>
// Uses C++20 features.
void PrintPi() {
std::cout << std::setprecision(16) << std::numbers::pi_v<long double> << '\n';
}
int main() {
#!/bin/bash
# stop script on first error
set -e
mkdir gcc_for_raspberrypi
cd gcc_for_raspberrypi
# variables that define the result
install_dir="$(pwd)/install"
#include <iostream>
using std::cout;
using std::string;
int main() {
// Uses C++11 features.
string os{};
// Detect operating system.
@Adobe-Android
Adobe-Android / brackets_or_braces.cpp
Created November 13, 2020 16:42
Is that a bracket, a brace, or something else?
// () parentheses or parens
// ( open paren
// ) close paren
// [] square brackets
// {} curly braces
// <> angle brackets
#include <iostream>
int main() {
@Adobe-Android
Adobe-Android / to_string.cpp
Created November 13, 2020 04:59
Example of the useful std::to_string method in C++11
#include <iostream>
using std::cout;
using std::string;
int main() {
auto pi = "pi is " + std::to_string(3.14);
cout << pi << '\n';
return 0;
}