Skip to content

Instantly share code, notes, and snippets.

View connorjan's full-sized avatar

Connor Goldberg connorjan

View GitHub Profile
#include <stdlib.h> // card > cjg.ppm
#include <stdio.h>
#include <math.h>
typedef int i;typedef float f;struct v{
f x,y,z;v operator+(v r){return v(x+r.x
,y+r.y,z+r.z);}v operator*(f r){ return
v(x*r,y*r,z*r);}f operator%(v r){return
x*r.x+y*r.y+z*r.z;}v(){}v operator^(v r
){return v(y*r.z-z*r.y,z*r.x-x*r.z,x*r.
y-y*r.x);}v(f a,f b,f c){x=a;y=b;z=c;}v

Using PIP to Download Packages for Offline Installation on a Different Platform

  1. On your device with access to the network, download the package and its requirements:

pip install <package> --download=<download-directory> --no-binary=:all:

or

pip download <package>

@connorjan
connorjan / mcupdate.py
Last active December 10, 2018 00:32
Script to update minecraft to the latest version
#!/usr/bin/env python
from __future__ import print_function
import json
import os
import sys
# User Variables
TYPE = "release" # "release" or "snapshot"
JAR_NAME = "{version}.jar"
LINK_NAME = "server.jar"
@connorjan
connorjan / example.service
Last active January 8, 2018 02:08
Making a systemd service
[Unit]
Description=My service
After=network.target
[Service]
ExecStart=/usr/bin/python3 -u example.py
WorkingDirectory=/home/user/example/
Restart=always
User=username
@connorjan
connorjan / shairport-sync-install.md
Last active December 16, 2023 13:22
shairport-sync installation for a Raspberry Pi
@connorjan
connorjan / shellcolors.sh
Created July 26, 2017 02:21
Definitions for the shell colors (and other attributes) through tput
# Text color - normal
fgblack="$(tput setaf 0)" # Black
fgred="$(tput setaf 1)" # Red
fggreen="$(tput setaf 2)" # Green
fgyellow="$(tput setaf 3)" # Yellow
fgblue="$(tput setaf 4)" # Blue
fgpurple="$(tput setaf 5)" # Purple
fgcyan="$(tput setaf 6)" # Cyan
fgwhite="$(tput setaf 7)" # White
@connorjan
connorjan / svg2eps.sh
Created July 14, 2017 21:02
Convert an SVG to EPS using Inkscape on macOS
#!/bin/bash
# Requirements:
# You must have the path to Inkscape in your path
# (/Applications/Inkscape.app/Contents/Resources/bin/inkscape)
# You must have coreutils installed ($ brew install coreutils) for greadlink
if (($# < 1)); then
echo "Usage: svg2eps input output"
exit 1
@connorjan
connorjan / Bash Cheatsheet.md
Last active June 25, 2017 20:08
Bash cheatsheet and shortcuts

Bourne-Again SHell and Linux CLI

© 2013 Martin Bruchanov, bruxy@regnet.cz

Set interpreter: #!/bin/bash    Remarks: # this is comment

Interactive control

Action set -o vi set -o emacs
@connorjan
connorjan / FunctionalCoverageCadence.md
Last active May 3, 2017 00:28
Generating a SystemVerilog Functional Coverage Report Using IMC

Generating a SystemVerilog Functional Coverage Report Using IMC

  1. Be sure you are calling ncverilog with the following flags to enable coverage tracking: -coverage all -covoverwrite

  2. In your SystemVerilog program block be sure to call the following SystemVerilog system function: $set_coverage_db_name("database_name");. the "database_name" can be of your choosing

  3. After the simulation is complete, the simulator will write a database with the coverage information to the cov_work directory by default

  4. Create a file called imc_report.cmd and paste the commands that are below. This file simply tells imc to load the database and which information to save to the report file. Be sure to change the "database_name" so it matches with the parameter in step 2.

@connorjan
connorjan / BashOnWindowsSublime.md
Last active July 23, 2017 00:40
Using Sublime Text on Bash on Windows

Using Sublime Text on Bash on Windows

  1. First make sure to install rsub in Bash (follow the tutorial here) and make sure it is in the $PATH environment variable.

  2. Create a symlink to the windows executable of Sublime Text so it is the $PATH (I use the ~/bin/ directory that I created). I did this by adding the following lines to my ~/.bashrc because I have found symlinks to be buggy in the Bash environment. This ensures the symlink is re-created each time Bash starts up. (Note: your installation path to the Sublime Text executable may vary)

    $ ln -sfn "$HOME/bin/wsub" "/mnt/d/Program Files/Sublime Text 3/subl.exe"