Skip to content

Instantly share code, notes, and snippets.

View JeffreyCA's full-sized avatar

Jeffrey JeffreyCA

View GitHub Profile
@JeffreyCA
JeffreyCA / gist:a821df8bba26c2aa84c7da5c71214049
Last active January 16, 2021 16:57 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@JeffreyCA
JeffreyCA / redis-scan-duplicate-scan.md
Last active August 5, 2020 18:49
Redis duplicate key issue when doing a SCAN
@JeffreyCA
JeffreyCA / Program.cs
Created May 13, 2020 13:13
Enable media streaming on Azure Blob
using System;
using Microsoft.WindowsAzure.Storage;
namespace EnableStreaming
{
class Program
{
static async System.Threading.Tasks.Task Main(string[] args)
{
var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=....");
{
"auto_complete": false,
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"detect_indentation": false,
"font_face": "Monaco",
"font_size": 13,
"open_files_in_new_window": false,
"tab_size": 4,
"theme": "Material-Theme.sublime-theme",
"word_wrap": "true"
@JeffreyCA
JeffreyCA / iterm.json
Created September 4, 2019 05:33
iTerm Profile
{
"Ansi 6 Color" : {
"Green Component" : 0.44183778762817383,
"Red Component" : 0.056145597249269485,
"Blue Component" : 0.48725795745849609
},
"Tags" : [
],
"Ansi 12 Color" : {
@JeffreyCA
JeffreyCA / .nano.rc
Created September 4, 2019 05:30
.nano.rc
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
##
## To make sure an option is disabled, use "unset <option>".
##
## For the options that take parameters, the default value is given.
@JeffreyCA
JeffreyCA / .bash_profile
Created September 4, 2019 05:27
.bash_profile
export PS1='\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
export EDITOR=nano
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -G'
@JeffreyCA
JeffreyCA / solve.py
Created August 13, 2019 03:15
775e97ff94e7dfe79293b62abed7e1ad17cdc6ebc82c4873cdca201c40569624
palindromic_primes = [2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 757, 787, 797, 919, 929, 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14741, 15451, 15551, 16061, 16361, 16561, 16661, 17471, 17971, 18181, 18481, 19391, 19891, 19991, 30103, 30203, 30403, 30703, 30803, 31013, 31513, 32323, 32423, 33533, 34543, 34843, 35053, 35153, 35353, 35753, 36263, 36563, 37273, 37573, 38083, 38183, 38783, 39293, 70207, 70507, 70607, 71317, 71917, 72227, 72727, 73037, 73237, 73637, 74047, 74747, 75557, 76367, 76667, 77377, 77477, 77977, 78487, 78787, 78887, 79397, 79697, 79997, 90709, 91019, 93139, 93239, 93739, 94049, 94349, 94649, 94849, 94949, 95959, 96269, 96469, 96769, 97379, 97579, 97879, 98389, 98689, 1003001, 1008001, 1022201, 1028201, 1035301, 1043401, 1055501, 1062601, 1065601, 1074701, 1082801, 1085801, 1092901, 1093901, 1114111, 1117111, 1120211, 1123211, 1126211, 1129211, 1134311, 1145411, 1150511, 1153511, 1160611, 1163611, 1175711, 1177711, 1178711,
@JeffreyCA
JeffreyCA / cs241-run-locally.md
Last active May 3, 2018 03:05
CS 241 - How to run student environment tools (cs241-binasm, cs241-twoints, etc. ) locally

Preface

This is a guide for students taking CS 241 at University of Waterloo who wish to use the provided student environment tools (cs241-binasm, cs241-twoints, cs241-array, etc.) on their local machines. This works best if you are using a Mac or Linux machine. If you find a way to make it work on Windows feel free to fork this and include the proper steps to do so.

After spending some time digging around in the student environment, I figured out a way to run these tools on your local machine, so you don't have to connect to the student environment and copy over your MIPS assembly files to execute them. This also enables you to test your programs without an internet connection.

Most of the tools were written in Java or Scala so they can be run on any computer with a JVM. So all you need is JDK installed on your local machine.

Prerequisites

@JeffreyCA
JeffreyCA / pq.cc
Created August 12, 2017 21:27
PriorityQueue Wrapper Implementation
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
class PQ {
vector<pair<int, int>> list;
public: