Skip to content

Instantly share code, notes, and snippets.

View ttm's full-sized avatar

rfabbri ttm

  • IFSC-USP, Juntadados, Nós Digitais, CDTL, ICMC/USP
View GitHub Profile
<?php
/**
* Reports view js file.
*
* Handles javascript stuff related to reports view function.
*
* PHP version 5
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
@ttm
ttm / vibrato.py
Created October 2, 2012 02:02
Vibrato in PCM audio (fixed!)
#-*- coding: utf8 -*-
#FIXED!!!
import numpy as n, pylab as p, scikits.audiolab as a
fa=44100 # sample rate
Dv=2048 # length of the table
fv=6. # vibrato frequency
nu=.2 # depth in semitones
f=440. # freq of the sound itself
#-*- coding: utf8 -*-
# implementation of recipe on: http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
import numpy as n, pylab as p
# variaveis de parametrizacao
fa=44100.
f=2.
# tipos: LPF, HPF, BPF, BPF2, notch
# APF, peakingEQ, lowShelf, highShelf
In [9]: aa=n.random.random((10,15))
In [10]: aa.sum(0)
Out[10]:
array([ 3.64094547, 5.48642567, 3.86113699, 3.83109877, 4.1542245 ,
4.43346198, 4.98849284, 4.44047022, 7.10656863, 4.83044752,
5.07810898, 6.59370274, 7.51975778, 3.9132313 , 5.2115709 ])
In [11]: aa.sum(1)
Out[11]:
<script src="d3/d3.js"></script>
<script src="jsnetworkx.js"></script>
pimpao
<script>
var G = new jsnx.Graph(); // or just jsnx.Graph();
G.add_node(1);
G.add_nodes_from([2,3]);
G.add_edge(1,3);
#-*- coding: utf8 -*-
from __future__ import division
import numpy as n, pylab as p
nbits=4
fa=8000 # Hz
nperiodos=1000.
passoFreq=20 # Hz
import pymongo, time as T
from twython import Twython
from maccess import tw # importando os acessos (só pegar no api.twitter)
TWITTER_API_KEY = tw.tak
TWITTER_API_KEY_SECRET = tw.taks
TWITTER_ACCESS_TOKEN = tw.tat
TWITTER_ACCESS_TOKEN_SECRET = tw.tats
t = Twython(app_key=TWITTER_API_KEY,
app_secret=TWITTER_API_KEY_SECRET,
a=`git log -1 HEAD --pretty=format:%s`
foo=`git remote show origin | grep Fetch`
b=(`echo $foo | tr ',' '\n'`)
aa \#gitcommit ::: $a \#repo ::: ${b[2]}
git commit -am $@
foo=`git remote show origin | grep Fetch`;
b=(`echo $foo | tr ',' '\n'`);
aa \#gitcommit ::: $@ \#repo ::: ${b[2]}
@ttm
ttm / gridLayout.js
Last active April 2, 2017 00:05
a solution to the challenge of the Helikar Lab GSoC2017
function gridLayout() {}
gridLayout.calculate = function(nodes, edges, size) {
var degrees = Array(nodes.length).fill(0);
edges.forEach(function(e) {
degrees[e.source.index] += 1;
degrees[e.target.index] += 1;
});
//getting the order of nodes from highest to lowest degrees