Skip to content

Instantly share code, notes, and snippets.

View Adobe-Android's full-sized avatar

David Brown Adobe-Android

View GitHub Profile
@Adobe-Android
Adobe-Android / convert_stdstring_to_char_array.cpp
Last active September 17, 2020 18:10
A small modern C++ example converting a std::string to a c-style string (character array).
#include <iostream>
#include <string>
void print_to_screen(const char* char_array) { std::cout << char_array << '\n'; }
int main() {
std::string std_str{"Hello, World!\n"};
const char* char_array{std_str.c_str()};
print_to_screen(char_array);
@Adobe-Android
Adobe-Android / get_i2C_address.ino
Last active June 1, 2019 20:38
My Arduino Software Collection
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(115200);
Serial.println("\nI2C Scanner");
}
void loop()
@Adobe-Android
Adobe-Android / .zshrc
Created April 15, 2019 04:53
Zshrc file
# Path to your oh-my-zsh installation.
export ZSH=/home/vm/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# POWERLEVEL9K_MODE='nerdfont-complete'
# ZSH_THEME="powerlevel9k/powerlevel9k"
ZSH_THEME="robbyrussell"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
@Adobe-Android
Adobe-Android / node.js
Created April 15, 2019 04:30
Some useful node.js commands
#!/usr/bin/env node
const {node: nodeVersion, v8: v8Version, openssl: sslVersion, unicode: uniVersion} = process.versions;
console.log("Node.js version:", nodeVersion);
console.log("V8 version:", v8Version);
console.log("OpenSSL version:", sslVersion);
console.log("Unicode support:", uniVersion);
// console.log(process.versions);
@Adobe-Android
Adobe-Android / Interface.cs
Last active September 17, 2020 17:48
Employee interface and implementation (in one file for convenience)
using System;
interface IEmployee
{
string Id { get; set; }
string FullName { get; set; }
string Email { get; set; }
string Phone { get; set; }
string Company { get; }
}
@Adobe-Android
Adobe-Android / read_file.c
Last active February 26, 2019 00:33
Read in a file and handle errors and write to a file and handle errors
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define bufSize 1024
int main(int argc, char const *argv[])
{
FILE *in;
char buf[bufSize];
@Adobe-Android
Adobe-Android / str_reverse.c
Created February 10, 2019 01:52
C string reversal
int main()
{
char s[20], r[20];
int begin, end, count = 0;
printf("Input a string\n");
scanf("%s", s);
// Calculating string length
while (s[count] != '\0')
@Adobe-Android
Adobe-Android / App.config
Last active February 12, 2019 00:26
C#-FTP - Connect to a server over FTPS, get a list of files in a specified directory, and rename those files
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<!--Replace with your .NET version here-->
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<appSettings>
<add key="FilePath" value="/sourcePath/"/>
<add key="DestinationPath" value="/destinationPath/"/>
<add key="UserName" value="user"/>
@Adobe-Android
Adobe-Android / Employee.cs
Created February 1, 2019 03:37
Demo for creating a new object/type and creating an instance method on that class
namespace Class_Instance_Method
{
class Employee
{
public string Id { get; set; }
public string FullName { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string doWork()
{
@Adobe-Android
Adobe-Android / fortune_cookie.c
Last active May 10, 2019 15:12
A gist collection of C concepts