Skip to content

Instantly share code, notes, and snippets.

View xiaoouwang's full-sized avatar
🎯
Focusing

Xiaoou WANG xiaoouwang

🎯
Focusing
View GitHub Profile
@xiaoouwang
xiaoouwang / extractComments.js
Created August 29, 2020 19:31 — forked from alexschreyer/extractComments.js
Extract comments from Acrobat PDF
// Get all annotations in current document
var annots = this.getAnnots();
// Assemble them into a Tab-delimited string (remove linebreaks in comments, too)
var cMyC = "Comment\tPage";
for ( var i=0; i<annots.length; i++ )
cMyC += ("\n"+annots[i].contents.replace(/(\r\n|\n|\r)/gm,"")+ "\t" + annots[i].page);
// Export them to MS Excel (opens the data there)
this.createDataObject({cName: "myCommentList.xls", cValue: cMyC});
@xiaoouwang
xiaoouwang / quickAnnotate.praat
Created July 24, 2020 15:46
add a quick annotation button to praat
To TextGrid (silences): 100, 0, -25, 0.1, 0.1, "", "sound"
Set tier name: 1, "phoneme"
name$ = selected$("TextGrid")
# writeInfoLine: name$
plusObject: "Sound 'name$'"
Edit
# Add action command: "Sound", 0, "", 0, "", 0, "Usual", "", 0, ""
# Add action command: "Sound", 0, "", 0, "", 0, "quickAnnotate", "Usual", 1, "path to quickAnnotate.praat"
@xiaoouwang
xiaoouwang / ttrwang.py
Created March 30, 2020 04:43
dm2_outilCorpus
# Xiaoou WANG 30/03/2020
import nltk # pour utiliser le tokeniser de phrases
import re
from collections import defaultdict
import matplotlib.pyplot as plt
# dictionnaire des mots contractés
contractions = {
"she'll": "she will",
"shouldn't've": "should not have",
from os import walk
# initiate a empty string
final_text = ""
# get all the files with extension js, the walk function gives a tuple
for (dirpath,dirname,filenames) in walk("/Users/rosingle/Documents/javascript/modernJavascript/"):
for file in filenames:
# the / is important :D
my_path = dirpath+"/"+file
if my_path.endswith(".js"):
with open(my_path) as file:
@xiaoouwang
xiaoouwang / BestPythonExercisesForBeginners-1-10.md
Created February 25, 2020 21:47
Best Python Exercises For Beginners 1-10
@xiaoouwang
xiaoouwang / 100BestPythonExercisesForBeginners-1-10.ipynb
Last active May 23, 2022 02:52
100 Best Python Exercises for Beginners 1-10
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xiaoouwang
xiaoouwang / pythonExercices.ipynb
Created February 25, 2020 12:05
python100Exercices
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xiaoouwang
xiaoouwang / toc.html
Created February 24, 2020 20:29
floating toc template for hugo academic
<style>
/* toc style */
#GoTop {
position: fixed;
right: 50px;
bottom: 30px;
background-color: #fafafa;
border: 1px solid rgba(0, 0, 0, .07);
border-radius: 1px;
@xiaoouwang
xiaoouwang / single.html
Last active February 24, 2020 20:27
hugo toc
{{- define "main" -}}
<article class="article">
{{ partial "page_header" . }}
<div class="article-container">
<div class="article-style">
{{ .Content }}
@xiaoouwang
xiaoouwang / nb_open.applescript
Last active February 3, 2020 15:55
an apple script to open jupyter notebook by double clicking
-- credits to https://stackoverflow.com/questions/30953227/double-click-to-open-an-ipython-notebook
variable="'$1'"
the_script='tell application "terminal" to do script "nbopen '
osascript -e "${the_script}${variable}\""