Skip to content

Instantly share code, notes, and snippets.

View datduyng's full-sized avatar

Dominic Nguyen datduyng

View GitHub Profile
@datduyng
datduyng / Pyodbc sqlserver lambda
Created October 2, 2020 03:23 — forked from carlochess/Pyodbc sqlserver lambda
How to install Pyodbc for Sqlserver.
# Start a container that mimic the lambda environment
docker run -it --rm --entrypoint bash -e ODBCINI=/var/task -e ODBCSYSINI=/var/task -v "$PWD":/var/task lambci/lambda:build-python2.7
# Then, download ODBC source code, compile and take the output
curl ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.5.tar.gz -O
tar xvzf unixODBC-2.3.5.tar.gz
cd unixODBC-2.3.5
./configure --sysconfdir=/var/task --disable-gui --disable-drivers --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE --prefix=/home
make install
cd ..
@datduyng
datduyng / README.md
Created December 16, 2018 04:12 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@datduyng
datduyng / Demo.java
Created November 6, 2018 20:18 — forked from cbourke/Demo.java
auto-posted gist
package cse.unl;
import java.time.LocalDate;
public class Demo {
public static void main(String args[]) {
LocalDate dateOfBirth = LocalDate.of(1990, 7, 9);
Student s1 = new Student(35140602, "Chris", "Bourke", 4.0, dateOfBirth);
@datduyng
datduyng / fileIO-H.md
Created November 6, 2018 20:17 — forked from cbourke/fileIO-H.md
auto-posted gist

File I/O

  • A file is a unit of stored memory, usually on disk
  • A file can also be... directories, buffers (standard input/output are files), a socket could be a file, a program is a file
  • You can write to and read from a file
  • Files may be plaintext or binary (or plaintext but not intended for human consumption: EDI, XML, JSON, base-64 encoding)
  • The basic steps to follow are:
    1. Open the file
    2. Process the file

String Processing

  • Strings represent data that may need to be processed
  • Common to deal with CSV (Comma separated value) or similar formatted data
  • Standard library functions can help, but processing involves designing algorithms

More Convenience functions in C

  • There is a ctype.h library that provides several "check" functions for single characters: isalpha(c), isdigit(c), islower(c), isupper(c), isspace(c), conversion: toupper(c), tolower(c), etc.
@datduyng
datduyng / loops-H.md
Created October 16, 2018 21:38 — forked from cbourke/loops-H.md
auto-posted gist

CSCE 155H - Computer Science I Honors

Loops

An introduction to loop control structures.

  • We need a way to repeatedly execute blocks of code
  • There are three basic elements to a loop control structure:
    • An initialization (where the loop starts)
    • A continuation condition (how long should the loop continue or when should it stop)
@datduyng
datduyng / strings-155H.md
Created October 16, 2018 21:38 — forked from cbourke/strings-155H.md
auto-posted gist

CSCE 155H - Computer Science I Honors

Fall 2018

Strings

  • Strings are ordered sequences of characters (may be ASCII or Unicode)
  • Different languages represent strings differently
  • Most languages provide a standard library of functions/methods to process strings

Strings in C

@datduyng
datduyng / arrays-155H.md
Created October 12, 2018 05:08 — forked from cbourke/arrays-155H.md
auto-posted gist

CSCE 155H - Computer Science I Honors

Arrays

  • It is rare to only deal with one piece of data
  • Usually, more than one number, string, object, etc.
  • Collections of data can be stored in arrays
  • In general:
    • arrays have a single identifier (name)
      • You can access individual elements in an array using an index
@datduyng
datduyng / functions-H.md
Created October 12, 2018 05:08 — forked from cbourke/functions-H.md
auto-posted gist

CSCE 155H - Computer Science I Honors

Functions & Methods

  • A function is a reusable unit of code that may take input(s) and may produce an output
  • Already familiar with functions: main(), printf(), sqrt(), etc.
  • Functions facilitate code reuse, you don't have to copy-pasta the same code over and over
  • Procedural abstraction: functions allow us to ignore the small details of how a certain block of code or algorithm works
  • Functions encapsulate functionality into reusable abstract code blocks
  • Standard libraries and functions have a lot of design, optimization, testing, debugging, etc. behind them, USE them
@datduyng
datduyng / conditionals-H.md
Created October 12, 2018 05:06 — forked from cbourke/conditionals-H.md
auto-posted gist

Conditionals

CSCE 155H - Fall 2018

  • Normally, programs have sequential control flow
  • However, more complex problems require decisions
  • Conditionals are how we can make some code execute under some condition(s) and/or other, different code to execute under other conditions
  • if-statements, if-else statements, if-else-if statements
  • Conditionals rely on some logical condition