Skip to content

Instantly share code, notes, and snippets.

@pjcrosbie
pjcrosbie / install-hyperv-enhanced-session.bash
Last active November 10, 2021 00:13
hyperv enhanced session xrdp for ubuntu and popos
#!/bin/bash
##################################################################################
# instructions
##################################################################################
# A. in hyper-v manager ensure Enhanced Sessions are allowed, may have to turn
# this off and then back on again
# B. ensure that can connect ot vm guest using socket
# run in windows host powershell
# > Set-VM -vmname "<guest-vm-name>" -EnhancedSessionTransportType HvSocket
@pjcrosbie
pjcrosbie / datetime.ps1
Created March 28, 2018 05:56
powershell
[datetime]"2014-01-24T13:04:23"
@pjcrosbie
pjcrosbie / readme.md
Created October 6, 2017 03:54 — forked from thomasingalls/readme.md
Use Rmarkdown with Python virtualenv

Motivation

Knitr beats the socks off of an iPython notebook. Both tools do the same job, but knitr doesn't require you to leave your established text editor workflow.

How to: Rmarkdown with Python virtualenv, for reproducibility.

Tested specifically on OS X 10.9, with R 3.1.2 and Anaconda python distribution.

  1. Calling an R script from the terminal will use the python version currently in the system PATH. If you need to specify a python 3.x or python 2.x environment, make your life easier and do it from the command line before you do anything else.
@pjcrosbie
pjcrosbie / Visual C++.sublime-build
Last active September 6, 2015 20:38 — forked from mikhdm/Visual C++.sublime-build
Visual C++ build system for sublime text to exec and compile .c and .cpp files from Subime Text editor.
{
"cmd": ["vcvars32.bat", "&", "cl", "/EHsc", "${file}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.cpp, source.c++",
// By default cl is not in your PATH, so add it to your path (preferably)
// or uncomment "path" and check that it has correct value
//"path": "path:/to/folder/where/cl.exe/located",
// this also will set path for vcvars32.bat
"shell": true, // Without this sublime has hard times to parse "&" in out command line
@pjcrosbie
pjcrosbie / s.bash
Last active August 29, 2015 14:26 — forked from dapangmao/s.bash
How to set up a spark cluster on digitalocean
sudo openvpn --config *.opvn
apt-get update
apt-get install vim
wget http://d3kbcqa49mib13.cloudfront.net/spark-1.3.0-bin-hadoop2.4.tgz | tar zxf
hadoop fs -mkdir /spark
hadoop fs -put spark-1.3.0-bin-hadoop2.4.tgz /spark
hadoop fs -du -h /spark
cp spark-env.sh.template spark-env.sh
@pjcrosbie
pjcrosbie / xorshift.py
Last active August 29, 2015 14:26 — forked from sklam/xorshift.py
numba cuda random device function
MAX32 = uint32(0xffffffff)
@cuda.jit("(uint64[::1], uint64)", device=True)
def cuda_xorshift(states, id):
x = states[id]
x ^= x >> 12
x ^= x << 25
x ^= x >> 27
states[id] = x
from pyparsing import *
stack = {
"my_number": 4,
"my_list": []
}
script = \
"""
push 5 to my_list.