Skip to content

Instantly share code, notes, and snippets.

View nhtranngoc's full-sized avatar

Nam Tran Ngoc nhtranngoc

View GitHub Profile
@nhtranngoc
nhtranngoc / cambridge_audio_scraper.py
Created May 8, 2024 17:00
Automated Scraper for Cambridge Listening Tests for various books (Preliminary 1, Preliminary 1 For School, New KET 1, New KET 1 For School, FIRST 4, FIRST 5, and C1 Advanced 4)
import requests
# Universal header, pretend we're a browser yay
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'}
book_prefixes = ["Pre1", "Prefs1", "Key1", "Kfs1", "ELT_First4", "ELT_FIRST5", "ELT_Adv4"]
test_count = 4
# PET has 4 sections
# KET has 5 sections
# FCE has 4 sections
@nhtranngoc
nhtranngoc / right_angled_triangle.c
Last active August 6, 2020 03:29
Program to check if input numbers are Pythagorean triplets.
// Written by Nam Tran Ngoc
#include <stdio.h>
#include <stdlib.h>
int main() {
unsigned int a, b, c;
printf("Please enter three positive integers as sides of a triangle, separated between spaces: \n");
scanf("%d %d %d", &a, &b, &c);
@nhtranngoc
nhtranngoc / CMakeLists.txt
Created June 14, 2020 00:54
yart - CMakeLists for tests
cmake_minimum_required(VERSION 3.10)
if(DEFINED ENV{CPPUTEST_HOME})
message(STATUS "Using CppUTest home: $ENV{CPPUTEST_HOME}")
set(CPPUTEST_INCLUDE_DIRS $ENV{CPPUTEST_HOME}/include)
set(CPPUTEST_LIBRARIES $ENV{CPPUTEST_HOME}/build/lib)
set(CPPUTEST_LDFLAGS CppUTest CppUTestExt)
else()
find_package(PkgConfig REQUIRED)
@nhtranngoc
nhtranngoc / CMakeLists.txt
Last active June 14, 2020 00:42
yart - CMakelist for stm32 target
make_minimum_required(VERSION 3.10)
set(LDSCRIPT "${CMAKE_SOURCE_DIR}/stm32f429i-discovery.ld")
set(LIBNAME "opencm3_stm32f4")
add_definitions(-DSTM32F4)
set(FP_FLAGS "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
set(ARCH_FLAGS "-mthumb -mcpu=cortex-m4 ${FP_FLAGS}")
set(OPENCM3_DIR "${CMAKE_SOURCE_DIR}/lib/libopencm3")
@nhtranngoc
nhtranngoc / arm_none_eabi_toolchain.cmake
Created June 14, 2020 00:27
Yart - Cross compiling arm toolchain file
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(OBJCOPY arm-none-eabi-objcopy)
@nhtranngoc
nhtranngoc / CMakeLists.txt
Created June 13, 2020 21:36
Yart's main CMakeLists
cmake_minimum_required(VERSION 3.10)
project(yart)
enable_language(C CXX)
if(CMAKE_CROSSCOMPILING)
message(STATUS "Crosscompiling enabled, using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
add_subdirectory(src)
else()
message(STATUS "No crosscompiling specified, compiling in /tests only.")
@nhtranngoc
nhtranngoc / mod.c.out
Created November 9, 2019 02:57
ECE4802 HW2 Part 2
15*29 mod 13 = 6
15*29 mod 12 = 3
15*28 mod 12 = 0
(15*29+7*12) mod 13 = 12
5^-1 mod 19 = 4
5^-1 mod 12 = 5
5^-1 mod 17 = 3
5^-1 mod 10 = -1
@nhtranngoc
nhtranngoc / des.out
Created November 5, 2019 18:19
Output of DES encrypter (first pass)
INPUT
1 1 0 0 0 1 0 0
0 0 1 0 1 0 0 0
0 1 0 1 0 0 0 0
0 1 1 0 1 0 0 1
EXPANSION
1 1 1 0 0 0
0 0 1 0 0 0
0 0 0 1 0 1
@nhtranngoc
nhtranngoc / out.txt
Last active November 1, 2019 03:16
Part 2 Output
./a.out
0: 0101 1000 0
1: 0010 1100 0
2: 0001 0110 0
3: 0000 1011 1
4: 0000 0101 1
5: 0000 0010 0
6: 0000 0001 1
7: 1000 0000 0
/*
ECE4802 - Cryptography
Homework 1
Part 2
Nam Tran Ngoc
*/
#include <stdio.h>
#include <stdint.h>