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
// Based on the blog post here: https://developers.notion.com/docs/getting-started | |
import { Client } from "@notionhq/client" | |
const notion = new Client({ auth: "<NOTION_KEY>" }) | |
const databaseId = "<NOTION_DATABASE_ID>" | |
async function addItem(paperLink, paperTitle, tags, comments, completedReading) { | |
// Add an item to the database | |
// Each item has a link (unique), title, tags (list of objects), comments and (boolean) reading status |
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 librosa | |
import numpy as np | |
def compute_impulse_response(ess_rec_path, ess_inv_path, target_ir_path): | |
""" | |
Computes impulse response using the Exponential sine sweep (ESS) method. | |
Code based on IR Capture project: http://tulrich.com/recording/ir_capture/ | |
Args: |
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
const fs = require('fs'); | |
const { spawn, fork } = require('child_process'); | |
const path_a = 'pipe_a'; | |
const path_b = 'pipe_b'; | |
let fifo_b = spawn('mkfifo', [path_b]); // Create Pipe B | |
fifo_b.on('exit', function(status) { | |
console.log('Created Pipe B'); |
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 os | |
import select | |
IPC_FIFO_NAME_A = "pipe_a" | |
IPC_FIFO_NAME_B = "pipe_b" | |
def get_message(fifo): | |
'''Read n bytes from pipe. Note: n=24 is an example''' | |
return os.read(fifo, 24) |
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
function lineArray = read_mixed_csv(fileName,delimiter) | |
fid = fopen(fileName,'r'); %# Open the file | |
lineArray = cell(100,1); %# Preallocate a cell array (ideally slightly | |
%# larger than is needed) | |
lineIndex = 1; %# Index of cell to place the next line in | |
nextLine = fgetl(fid); %# Read the first line from the file | |
while ~isequal(nextLine,-1) %# Loop while not at the end of the file | |
lineArray{lineIndex} = nextLine; %# Add the line to the cell array | |
lineIndex = lineIndex+1; %# Increment the line index | |
nextLine = fgetl(fid); %# Read the next line from the file |
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
#!/bin/sh | |
#This script can be used as a sort of download accelerator and also it can be used to download large files from a url in parts. | |
#Here, as an example, I've used it to download the kubuntu 15.10 version | |
#url1, url2, url3, url4 are user-defined variables | |
url1=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso | |
url2=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso | |
url3=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso | |
url4=http://d33vwem6kwnf57.cloudfront.net/kubuntu-15.10-desktop-amd64.iso |
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
/** scroll to top function in AngularJS */ | |
angular.module('demoApp').controller('controller', ['$scope', function($scope) { | |
$scope.scrollToTop = function($var) { | |
// 'html, body' denotes the html element, to go to any other custom element, use '#elementID' | |
$('html, body').animate({ | |
scrollTop: 0 | |
}, 'fast'); // 'fast' is for fast animation | |
}; | |
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
/* directive to disable input if num(chars) crosses maxLength in text-area in pagePopUp */ | |
angular.module('notify.pageEOCApp').directive('textMaxlengthDirective', function() { | |
return { | |
require: 'ngModel', | |
link: function(scope, element, attrs, ngModelCtrl) { | |
var maxlength = Number(attrs.textMaxlength); | |
function fromUser(text) { | |
if(text.length > maxlength) { |