Skip to content

Instantly share code, notes, and snippets.

@john9631
john9631 / TestVars.py
Last active May 3, 2018 05:24
print conditional expression
print(
'string involved' if str in {type(varA), type(varB)} else
'bigger' if varA > varB else
'smaller' if varA < varB else
'equal'
)
@john9631
john9631 / MITx_Cython_01b_Fibs.ipynb
Created June 23, 2017 04:33
MITx_Cython_01b Fibs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@john9631
john9631 / MITx_Cython_01_Fibs.ipynb
Last active June 22, 2017 10:38
MITx_Cython_01 Fibs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/sh
cp -pru /home/john/zRamdisk/subdirectory1/* /home/john/.wine/drive_c/subdirectory1/
rm /home/john/stop_time
date +%D' '%T > /home/john/stop_time
[Unit]
Description=Save Ramdisk to Wine drive C
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
ExecStop=/home/john/.scfullcopy_atend
[Install]
[Unit]
Description=Startup Applications
[Service]
Type=oneshot
RemainAfterExit=false
ExecStart=/home/john/.scopening_atstart
[Install]
WantedBy=multi-user.target
{
"metadata": {
"language": "Julia",
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"language": "Julia",
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"metadata": {
"language": "Julia",
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
def memoize(f):
def mem(x):
if x not in cache:
cache[x] = f(x)
return cache[x]
cache = {}
return mem
#@memoize
def fib(n=1):