Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / direnv-win.md
Created July 5, 2022 13:57 — forked from rmtuckerphx/direnv-win.md
Steps to install direnv on Windows

direnv on Windows

Overview

In JavaScript projects, I used to use dotenv so that I could put local environment variables in a .env file for local development. But dotenv requires you to add code to your project. With direnv, you can put local env vars in a .envrc file and those env vars are loaded automatically in the shell.

Steps to install

For these steps, it is assummed that you have installed Git Bash on Windows. I also use VSCode as my editor.

  1. Create a folder such as c:\tools to put the direnv.exe file and add it to the Windows PATH
@cicorias
cicorias / .bash_profile
Created May 6, 2022 18:35 — forked from gowravshekar/.bash_profile
Hive 2.3.3 with Hadoop 3.1.0 on Mac OS
export HADOOP_HOME=/Users/username/Tools/hadoop-3.1.0
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
alias hstart=$HADOOP_HOME/sbin/start-all.sh
alias hstop=$HADOOP_HOME/sbin/stop-all.sh
export HIVE_HOME=/Users/username/Tools/apache-hive-2.3.3-bin
export PATH=$PATH:$HIVE_HOME/bin

Generate Jar with dependencies (fatJar) using Gradle

There are multiple posts (old and new) with instructions on how to generate a fat jar, this is, a jar file for your application containing also your application's dependencies. Most solutions I have tried did not work for me, even in a simple Hello World java application, but I have found one that seems to work as expected.

Here it is:

Instructions

@cicorias
cicorias / docker-for-mac.md
Created March 13, 2022 16:33 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@cicorias
cicorias / CaesarCipher.asm
Created January 20, 2022 15:01 — forked from ManeeshaPerera/CaesarCipher.asm
The following program is a CaesarCipher encryption algorithm written in MIPS assembly language
.data
prompt: .asciiz "Encrypt(E) or Decrypt(D) ?"
indata: .space 20
plaintext: .asciiz "Enter Plain text: "
ciphertext: .asciiz "Enter Cipher text: "
data: .space 40
Key: .asciiz "Key ?"
WrongKeyword: .asciiz "\nPlease enter a valid character"
.text
main:
@cicorias
cicorias / .gitattributes
Last active January 5, 2022 14:09 — forked from hughbiquitous/.gitignore
.gitignore for Java/IntelliJ/gradle
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
@cicorias
cicorias / modsqrt.py
Last active December 14, 2021 01:41 — forked from nakov/modsqrt.py
mod_sqrt - Python 3 implementation
def modular_sqrt(a, p):
def legendre_symbol(a, p):
""" Compute the Legendre symbol a|p using
Euler's criterion. p is a prime, a is
relatively prime to p (if p divides
a, then a|p = 0)
Returns 1 if a has a square root modulo
p, -1 otherwise.
@cicorias
cicorias / ecc.py
Created December 12, 2021 02:16 — forked from bellbind/ecc.py
[python]basics of elliptic curve cryptography
# Basics of Elliptic Curve Cryptography implementation on Python
import collections
def inv(n, q):
"""div on PN modulo a/b mod q as a * inv(b, q) mod q
>>> assert n * inv(n, q) % q == 1
"""
for i in range(q):
if (n * i) % q == 1:
@cicorias
cicorias / rsa.py
Created October 26, 2021 20:59 — forked from djego/rsa.py
A simple RSA implementation in Python
'''
620031587
Net-Centric Computing Assignment
Part A - RSA Encryption
'''
import random
'''
@cicorias
cicorias / modinverse.py
Created October 25, 2021 19:56 — forked from ofaurax/modinverse.py
Modular Inverse for RSA in python
#!/usr/bin/env python3
p = 61
q = 53
n = p*q
phi = (p-1)*(q-1)
# Took from SO
def egcd(a, b):