This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
app/controllers/attachments_controller.rb | 4 +- | |
app/controllers/wiki_controller.rb | 41 +++++++++++++------ | |
app/helpers/application_helper.rb | 16 +++----- | |
app/helpers/wiki_helper.rb | 14 +++++-- | |
app/models/wiki.rb | 21 ++++++++-- | |
app/models/wiki_content.rb | 6 ++- | |
app/models/wiki_page.rb | 14 +++++-- | |
app/views/wiki/_new_modal.html.erb | 2 +- | |
app/views/wiki/annotate.html.erb | 4 +- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.vertexfragment.com/ramblings/cantor-szudzik-pairing-functions/ | |
# https://stackoverflow.com/questions/38965931/hash-function-for-3-integers | |
# https://math.stackexchange.com/questions/222709/inverting-the-cantor-pairing-function | |
def normalize(x): | |
# this function make cantor pairing function work for negative numbers | |
return 2*x if (x>=0) else (-2*x-1) | |
def normalize_inv(x): | |
return x//2 if (x % 2 == 0) else -(x+1)//2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set (CMAKE_CXX_STANDARD 14) | |
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) | |
project(MY_GRAND_PROJECT) | |
# specify the components required | |
#find_package(PCL 1.10 REQUIRED COMPONENTS common io) | |
# or use all available components | |
find_package(PCL 1.12 PATHS "$ENV{HOME}/Documents/pcl/build") | |
#find_package(PCL 1.10 REQUIRED) | |
include_directories("/usr/include/eigen3") | |
include_directories("$ENV{HOME}/Documents/pcl") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb | |
index 4a88079..e7496fb 100644 | |
--- a/app/controllers/attachments_controller.rb | |
+++ b/app/controllers/attachments_controller.rb | |
@@ -158,8 +158,10 @@ class AttachmentsController < ApplicationController | |
@attachment.destroy | |
end | |
+ container = @attachment.try(:container) || @container | |
respond_to do |format| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zlib | |
import zipfile | |
from tqdm import tqdm | |
#https://stackoverflow.com/questions/47438424/python-zip-compress-multiple-files | |
def compress(path, file_names): | |
print("Containing directory:") | |
print(path) | |
print("File Paths:") | |
print(file_names) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
nb_fname = "xxx.ipynb" | |
with open(nb_fname, "r", encoding="utf-8") as f: | |
nb = json.load(f) | |
cells = nb['cells'] | |
print("There are", len(cells), "cells") | |
for cell in cells: | |
source = ''.join(cell['source']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
from bs4 import BeautifulSoup | |
import wget #for downloading files | |
# convert url to normal string | |
from urllib.parse import unquote | |
import os | |
url_base = "https://sourceforge.net/" |