Skip to content

Instantly share code, notes, and snippets.

View balos1's full-sized avatar

Cody Balos balos1

View GitHub Profile
@balos1
balos1 / remote_modelsim.sh
Created February 5, 2017 08:57
Remotely use modelsim.
#!/bin/sh
#configuration
REMOTE_USER=john.doe
REMOTE_HOST=122.22.22.221
REMOTE_HOME='/home/john.doe'
REMOTE_MODELSIM_DIR='/opt/altera/10.0/modelsim_ase/bin'
COMMAND=`basename $0`
# calculate the arguments, with proper quotes around each argument

Keybase proof

I hereby claim:

  • I am cojomojo on github.
  • I am cojomojo (https://keybase.io/cojomojo) on keybase.
  • I have a public key ASBqujW0BwmCbhK4KbJqvLkybXQ8NAPOJxkOFHg9tH1eJAo

To claim this, I am signing this object:

#!/bin/zsh
rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /media/cody/Backup/cbalos-nixtop
@balos1
balos1 / mathmacros.sty
Last active July 25, 2017 01:48
Macros for writing mathematical documents in LaTex.
% Helpful math mode macros.
%
% (c) Cody Balos
\NeedsTeXFormat{LaTeX2e}[]
\ProvidesPackage{mathmacros}[2017/01/20 Math Macros]
\RequirePackage{amsmath}
\ProcessOptions\relax
@balos1
balos1 / homework.sty
Last active July 25, 2017 01:49
LaTex package for creating beautiful homework.
\NeedsTeXFormat{LaTeX2e}[]
\ProvidesPackage{homework}[2017/03/07 Homework]
\RequirePackage{amsmath}
\RequirePackage{extramarks}
\RequirePackage{stackengine}
%% 'sans serif' option
\DeclareOption{sans}{
\renewcommand{\familydefault}{\sfdefault}
# Created by https://www.gitignore.io/api/latex
### LaTeX ###
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
#!/bin/bash
# console colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# project name comes top folder name by default
PROJECT=$(basename $PWD)
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
(num, idx) = (nums[0], 0)
dct = dict([(num, idx)])
for idx2, num2 in enumerate(nums[1:]):
#include "stdio.h"
int hammingDistance(int x, int y) {
int diff = x^y;
int distance = 0;
for (int i = 0; i < 32; ++i) {
if ((diff & (1 << i)) != 0) {
++distance;
}
}
#include <iostream>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
/**