Skip to content

Instantly share code, notes, and snippets.

View ak9999's full-sized avatar
🎯
Focusing

Abdullah "AJ" Khan ak9999

🎯
Focusing
View GitHub Profile
/*
Author: Abdullah Khan
Purpose: Show off C++14 automatic return type deduction.
Build: g++ -std=c++14 automatic_return_type_deduction.cpp -o create_pair
Run: Invoke create_pair with two parameters: words or numbers work best.
*/
#include <iostream>
#include <utility>
// File: progress_bar_example.cpp
// Modified from https://stackoverflow.com/questions/14539867/how-to-display-a-progress-indicator-in-pure-c-c-cout-printf
// Compile with:
// g++ -std=c++14 -o prog progress_bar_example.cpp -Werror -pedantic
#include <iostream>
#include <chrono> // for literals
#include <thread> // for cross-platform sleep
int main()
{
@ak9999
ak9999 / reverse.cpp
Created March 13, 2017 16:18
reverse a string
// Compile with g++ -std=c++14 reverse.cpp
#include <iostream> // std::cout
#include <string> // std::string
#include <utility> // std::swap
using namespace std;
string reverse(string & s) {
// Ternary conditional
// If string is of even length, n = string length
@ak9999
ak9999 / k-th_smallest_element.cpp
Last active March 14, 2017 02:39
Find the second smallest element
// Abdullah Khan
// Compile with: g++ -std=c++14 k-th_smallest_element.cpp
// Second smallest value in unsorted array/vector/list
#include <iostream>
#include <vector>
#include <utility>
#include <random>
using Generator = std::mt19937;
@ak9999
ak9999 / rust_guessing_game_print.rs
Created April 6, 2017 20:56
Guessing Game Tutorial from Rust docs using the `print!` macro.
extern crate rand; // rand crate for generating random numbers
use std::io; // io library from standard library
use std::io::Write; // Needed for flushing stdout after print.
use std::cmp::Ordering; // For comparing values
use rand::Rng; // from rand crate
fn main() {
println!("Guess the number, from 0 to 100."); // Greet user
let secret_number = rand::thread_rng().gen_range(0, 101);
@ak9999
ak9999 / create_highsierra_iso.py
Last active January 4, 2018 04:40
Simple script written for fun that creates a macOS High Sierra ISO.
#!/usr/bin/env python3
"""
This script creates a macOS High Sierra bootable ISO.
Requires Python 3.6, macOS, and macOS High Sierra app installed.
Created using info gathered from here: https://gist.github.com/agentsim/00cc38c693e7d0e1b36a2080870d955b
Purpose: I just wanted to try out the subprocess library.
"""
@ak9999
ak9999 / DisplayLinkManager.log
Created September 28, 2018 17:17
Output from /var/log/displaylink/DisplayLinkManager.log for displaylink-debian
UVLY+3xs9LIslFFJL9zz9ZX/E8tch0h1gXBEL4FgoejQ9yQ/0abH8BYtlJeU1ADc3SFuE3wL+QT3GNZJWHAGbuEdinxloggMORGnbuQ6SZSa31gNy0HO2ze7bd0TLJa3BNtmzN/u40gehGsXFn3/Ve
ZjkII9ANA26kQnxsGo1dnnUUMkMT9XrDIfj9Xb+6TZNiJYl7+qD6xqQRdac61izYNQcOxIa7xwxdXqjWnEMUmBDBE7R1wxNRTSLvMAo6itab8yZnjF1OAzsesXfeWIFgz/yrHNsgeQ5JhFuitUsa9n
GtBLVrYpJaqnEQQtHdg2Uez09d89YDa3tq+afeVxC9Bgul6ga1W5FrwnZLgNmeaj+bOnLU3y/za1L6dwuUh6IqakNyx3vTrb0DDnb2fw7w==
F6ny/x7M/S/F1fu0oS2K41aR1n8URVQQ+ipS4NMLIkQoWhR5YEQMq2Tq5SP+RdIHK9blfFEBFZNJ9hcJkBt+9QJprvq+g0Gm3owr8jGfZ85yh8s+ChwENKeJRiQgs/Wr5n6JOH9b3EEAIUxPzTQ2/W
zFvpDR28TN9BqCUn0QUts1lnKX3+FfOC4J4lZhnsLfTKAkGxeNSaZ/2jtwMeX1VRVY8dyu3l8hVfogXC3sVxD5qwjaOd0i3moJWwbyDWQspunIY2GAONcgkH+6u87UPjHMuZcfCGPyu/YKpcEZg8FP
DLw58uU0o4Upbtq3aGaaOOV475tZ7Gi3zXJRBnfi+A==
1G2JyAkrPgv/ueMVOOIxM04Oqx1yXoXoCv99KNN0AqhDacpn6iaXn6wmdfDooqxV7oThGMzwPuFrtYSzyfq6xE6WsLuMnBwxjlKvfTr7/JQus3ALYXD05D+XjRIP2EHKo19rLUmtkk+hfGeuh/OSEc
V1+pZ9fSpkkS7+KvVF4Q2HkJRjLnWxqoRapd++vGXFaIOGKlF61VjIUNWo0RWRDINJExW3ONMVXatrNwIvW20zgB05STnpz9fMYGq4oCKUHU0AhXZ8s
@ak9999
ak9999 / create_mojave_iso.py
Created January 20, 2019 17:57
Simple script written for fun that creates a macOS Mojave ISO.
#!/usr/bin/env python3
"""
This script creates a macOS Mojave bootable ISO.
Requires Python 3.6, macOS, and macOS Mojave app installed.
Created using info gathered from here: https://gist.github.com/agentsim/00cc38c693e7d0e1b36a2080870d955b
Purpose: I just wanted to try out the subprocess library.
"""
@ak9999
ak9999 / reset_audio_levels.bat
Created March 31, 2019 21:59
reset_audio_levels.bat
@ECHO OFF
ECHO Reset Volume Mixer Settings...
NET STOP Audiosrv
NET STOP AudioEndpointBuilder
REG DELETE "HKCU\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /F
REG ADD "HKCU\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore"
from csv import reader
from collections import namedtuple
import logging
import subprocess
# TODO: In the future this script should also possibly generate the data so that no other steps are required.
# E.g.:
# gam all users show filelist id alternateLink query "'[email protected]' in readers" > file.csv
# gam all users show filelist id alternateLink query "'[email protected]' in writers" > file.csv