Skip to content

Instantly share code, notes, and snippets.

View vedal's full-sized avatar

Amund Vedal vedal

View GitHub Profile
@vedal
vedal / Signal reconstruction from spectrograms.ipynb
Created March 5, 2019 15:53 — forked from carlthome/Signal reconstruction from spectrograms.ipynb
Try to recover audio from filtered magnitudes when phase information has been lost.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vedal
vedal / remove_duplicates_inplace
Last active January 31, 2018 10:31
[Remove duplicates in-place] loop over list and remove duplicates with O(1) space complexity #list #duplicates #inplace
// vim: syntax=python
def removeDuplicates(nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) < 2:
return len(nums)
@vedal
vedal / string_remove_punctuation_using_regex
Last active January 31, 2018 11:31
[Remove punctuation from string using regex] Use regex to clean string punctuation fast #punctuation #strip #regex
// vim: syntax=python
# remove punctuation
re.sub(r'[^\w\s]','',string)
@vedal
vedal / corrent_py2.7_open_read_write
Last active January 31, 2018 11:31
[Correct open,read,write from files] #Python #open #read #write
// vim: syntax=python
# In Python 2.6+, you could use io.open() that is default (builtin open()) on Python 3:
import io
with io.open("filename.txt", 'r') as file:
# count lines of file
num_lines = sum(1 for line in file)
# get N lines
@vedal
vedal / data.csv
Last active January 31, 2018 11:38
IVIS Project 1
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
Number,Alias,"Please, tell me about yourself. What interest you? Do you have any hobbies?",What do you expect to learn in Information Visualization? How do expect to use what you learn?,IVIS,Stats,Math,Art,User,Prog,Graphics,HCI,UX
1,Aldor,I have great interest in visual design and filmmaking. ,"I expect to learn the why, how and what of the visualization of data. Thinking of the why in order to create meaningful visualizations and the how & what to learn the programming and design that is involved. ",7,3,3,9,6,2,1,4,8
2,Aragorn,"I have been an aviation enthusiast since I was a kid, although I do not hold a pilot's license (yet). I enjoy cooking and I try to follow a healthy lifestyle with regular physical activity, such as cycling, running or team sports, mostly football. I have developed an increasing interest in all sorts of water-sports over the past few years, mostly in free-diving and surfing. I have an appreciation for all art forms but I am far from being an art-savvy. ","I am working on several perso