Skip to content

Instantly share code, notes, and snippets.

View connorjan's full-sized avatar

Connor Goldberg connorjan

View GitHub Profile
import socket
import struct
import argparse
import binascii
parser = argparse.ArgumentParser(version="0.1",description='Magic packet sender')
parser.add_argument('--mac', action="store", default=None, required=True, help="The mac address to wake up")
arg = parser.parse_args()

Keybase proof

I hereby claim:

  • I am connorjan on github.
  • I am connorjan (https://keybase.io/connorjan) on keybase.
  • I have a public key whose fingerprint is DB55 6494 216F CD37 478A D420 DFE6 88D9 E17E 605D

To claim this, I am signing this object:

#!/usr/bin/env python
import random
faces = ["U","D","L","R","F","B"]
modifiers = ["", "'", "2"]
min_scramble_len = 16
max_scramble_length = 20
@connorjan
connorjan / PiEthernetOverUSB.md
Last active March 18, 2017 19:53
Setting up Ethernet over USB on a Raspberry Pi Zero

How to enable Ethernet/SSH over USB on a Raspberry Pi Zero

  1. Flash the latest kernel onto an SD card using the instructions here: https://www.raspberrypi.org/documentation/installation/installing-images/README.md

  2. Mount the SD card and browse to the boot partition using a file browser

  3. Enable the USB controller by opening up the config.txt file and adding a new line which contains the following: dtoverlay=dwc2

  4. Enable the ethernet gadget driver by opening up the cmdline.txt file and add the following text to the end of the line: modules-load=dwc2,g_ether

@connorjan
connorjan / Raspberry Pi Multi-User Boot Script Setup.md
Last active April 12, 2017 15:23
Guide to setting up automatic boot scripts for multiple users on a Raspberry Pi

Raspberry Pi Multi-User Boot Script Setup

This will show how you can setup scripts that will run on bootup of a Raspberry Pi. Any user in the /home/ directory where the name of the user matches the name of their home directory will be able to take advantage of this setup, as well as the root user.

  1. Add the following code to the file: /etc/rc.local, but be sure to leave the last line of the file as exit 0
# Startup scripts
## Root
if [ -f /root/startup.sh ]; then
@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 / common.py
Last active June 23, 2017 23:05
Common python functions
def expand(lst):
""""
Expand a list/tuple of lists/tuples of lists/tuples of ... of values into a single list
"""
exp = []
for item in lst:
if type(item) is list or type(item) is tuple:
exp += expand(item)
else:
exp.append(item)
@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 / 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 / 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"