Skip to content

Instantly share code, notes, and snippets.

@jlollis
jlollis / Setting_upa_new_repo.md
Created December 15, 2018 19:41 — forked from alexpchin/Setting_upa_new_repo.md
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"

git remote add origin [email protected]:alexpchin/.git

@jlollis
jlollis / powershell_wrapper.sh
Created December 15, 2018 19:41 — forked from fridtjof/powershell_wrapper.sh
This is a wrapper for launching powershell scripts using shebang on WSL. Put the name of your user's directory into the second line, save this file into /usr/bin and make it executable.
#!/bin/bash
YOUR_WINDOWS_USERDIRECTORY_NAME_HERE=""
WIN_TEMP_PATH="/mnt/c/Users/$YOUR_WINDOWS_USERDIRECTORY_NAME_HERE/AppData/Local/Temp"
CURRENT_DIR=`pwd`
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit 1
@jlollis
jlollis / clone-all-twitter-github-repos.sh
Created January 4, 2019 14:33 — forked from caniszczyk/clone-all-twitter-github-repos.sh
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@jlollis
jlollis / Merge-PDF.ps1
Created January 13, 2019 02:35 — forked from aaroncalderon/Merge-PDF.ps1
Merge PDFs with PowerShell
#Not my code, this is from Mike Pfeiffer - http://mikepfeiffer.net/2010/03/how-to-merge-pdf-files-using-powershell-and-pdfsharp/
#Requires PDFSharp assembly libraries http://sourceforge.net/projects/pdfsharp/
#You need to load the assembly before you can use the function
#
#Merge-PDF -path c:\pdf_docs -filename c:\saved_docs.pdf
Add-Type -Path C:\assemblies\PdfSharp.dll
Function Merge-PDF {
Updating WSL
Updating Packages in WSL
Because WSL uses a standard Ubuntu installation, upgrading your packages should look very familiar:
$ sudo apt-get update
$ sudo apt-get upgrade
Updating the Ubuntu OS
You can aso upgrade to the latest version of Ubuntu with the following command (caution, this will take quite some time)!:
Install PostgreSQL using WSL
This doc explains how to install PostgreSQL 10 for Windows WSL
We are installing this through the Ubuntu command line since we want this software to run in the Linux environmnet. You can check out the PostgreSQL Linux install docs here.
Install
Open a terminal (the Ubuntu app) and then go to the root of the Ubuntu Subsystem by typing cd ~ .
Type sudo nano ../../etc/apt/sources.list. This will open a file on Ubuntu using the Nano editor.
At the bottom of this file, paste in this line deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main
Change the last part of the line above from xenial- to whichever version of Ubunutu you are running.
function move(n, a, b, c) {
if (n > 0) {
move(n-1, a, c, b);
console.log("Move disk from " + a + " to " + c);
move(n-1, b, a, c);
}
}
move(4, "A", "B", "C");
@jlollis
jlollis / Wolf
Created February 19, 2019 05:28
Play the Orginal Wolfenstein 3D on Linux
#!/bin/bash
sudo apt-get update
sudo apt-get install dosbox wget
mkdir -p wolf3d
cd wolf3d
wget http://image.dosgamesarchive.com/games/1wolf14.zip
unzip *.zip
dosbox INSTALL.EXE
echo "After setup cd into the new wolf3d directory"
@jlollis
jlollis / Wolf
Created February 19, 2019 05:28
Play the Orginal Wolfenstein 3D on Linux
#!/bin/bash
sudo apt-get update
sudo apt-get install dosbox wget
mkdir -p wolf3d
cd wolf3d
wget http://image.dosgamesarchive.com/games/1wolf14.zip
unzip *.zip
dosbox INSTALL.EXE
echo "After setup cd into the new wolf3d directory"
@jlollis
jlollis / gist:d70f3759fccf95dffa1f4b130c5104b4
Created February 19, 2019 20:11 — forked from nicc/gist:667755
Ruby's Enumerable #map and #select methods implemented with #inject
# The idea is just to illustrate that Ruby's #map and #select Enumerable methods
# are simply specific flavours of a fold operation, which Ruby implements as #inject.
# I've implemented #map and #select using #inject, and at the end I implemented #inject
# recursively. Ruby does #inject with Array#each, for very good reason. The recursive
# implementation is really just to illustrate the core Functional Programming concept
# which it derives from.
# We'll start simple. Map without applying a function:
[1,2,3,4,5].inject([]) {|memo, obj| memo << obj }