Skip to content

Instantly share code, notes, and snippets.

@jlollis
jlollis / new-course-setup.sh
Last active December 17, 2019 20:46
nested directories creation script for a new coursera course
# one liner for outer folders only (if it varies from week to week)
mkdir $(seq --format 'week-%.0f' 1 12)
# version with nested subfolders
for i in {1..12}; do
if [[ $i -lt 10 ]]
then
mkdir week-0"$i"
mkdir -p week-0"$i"/exercises
mkdir -p week-0"$i"/slides
@jlollis
jlollis / rbenv.sh
Last active September 24, 2019 20:25 — forked from bylatt/rbenv.sh
Install ruby 2.2.3 with rbenv and ruby-build on Ubuntu 14.04
# install ruby 2.2.3 with rbenv on ubuntu 14.04
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
@jlollis
jlollis / Random.jack
Created May 16, 2019 16:20 — forked from ybakos/Random.jack
Jack Pseudo Random Numbers for Nand 2 Tetris
/* Random.jack
* By Mark Armbrust
* http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/Random-number-generator-for-hack-cpu-td4025503.html
* Also see:
* http://nand2tetris-questions-and-answers-forum.32033.n3.nabble.com/Pseudo-Random-Number-Generator-td4026059.html#a4027617
*/
class Random {
static int seed;
@jlollis
jlollis / rbenv-commands.txt
Created May 3, 2019 17:26
Rbenv Cheatsheet
rbenv commands
# Install rbenv
$ brew install rbenv
# Completely uninstall rbenv
$ brew uninstall rbenv
# list all available versions
$ rbenv install -l
@jlollis
jlollis / install-alternate-rails-with-rbenv.md
Last active May 3, 2019 22:51
installing an earlier version or rails with rbenv
  1. For legacy projects, check your installed versions of ruby against this list.

  2. If you have a version that will work with the Rails version you need, then proceed to 4, if not go to 3, install an compatible version using rbenv.

  3. After installing a compatible version, switch your local ruby version for your project folder to the relevant one:

rbenv versions
rbenv local 2.4.0
rbenv versions
@jlollis
jlollis / wsl_first_time_setup.sh
Created May 3, 2019 16:19 — forked from danwhitston/wsl_first_time_setup.sh
Setting up my WSL environment - includes git & key, rbenv, rbenv ruby-build, attis, imagemagick, ruby, bundler, mysql, mongodb, redis
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade
ln -s "/mnt/c/Users/Daniel/Documents/homeflow" ~/homeflow
ln -s "/mnt/c/Users/Daniel/Documents" ~/documents
mkdir .ssh
cp documents/id* .ssh/
sudo chmod 600 .ssh/*
cd homeflow/attis
git pull
@jlollis
jlollis / clearfix.html
Created April 1, 2019 15:40
CSS Clearfix example
<!DOCTYPE html>
<html>
<head>
<style>
div {
border: 3px solid red;
padding: 5px;
}
.img {
@jlollis
jlollis / index.md
Created April 1, 2019 15:00 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@jlollis
jlollis / python_lists.py
Created March 22, 2019 04:56
Python list basics
# Create an empty list using square brackets.
numbers = []
print(numbers) # Output: []
# Create an empty list using list().
numbers = list()
print(numbers) # Output: []
# Create a list of numbers.
numbers = [1, 2, 3]
@jlollis
jlollis / python_sets.py
Created March 22, 2019 04:54 — forked from ShyamaSankar/python_sets.py
A cheat sheet for Python sets.
# Create an empty set using the constructor method.
numbers = set()
print(numbers) # Output: set()
# Note: {} creates a dictionary in Python.
print(type({})) # Output: <class 'dict'>
# set() constructor function takes an iterable as input.
numbers = set([1, 2])
print(numbers) # Output: {1, 2}
string_set = set("hello")