Batch loop for wave to mp3 (using lame)
@echo off if NOT EXIST MP3 md MP3 if NOT EXIST WAV md WAV for %%f in (*.wav) do ( cls lame -b 96 -V 5 -B 128 -m j --vbr-new -q 5 "%%f" "MP3\%%f.mp3" move "%%f" WAV )
11390 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
@echo off if NOT EXIST MP3 md MP3 if NOT EXIST WAV md WAV for %%f in (*.wav) do ( cls lame -b 96 -V 5 -B 128 -m j --vbr-new -q 5 "%%f" "MP3\%%f.mp3" move "%%f" WAV )
curl -v -k -u jakobm "https://members.dyndns.org/nic/update?hostname=jakobm.dyndns.org&myip=217.80.116.128&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
def prettySize(size): suffixes = [("B",2**10), ("K",2**20), ("M",2**30), ("G",2**40), ("T",2**50)] for suf, lim in suffixes: if size > lim: continue else: return round(size/float(lim/2**10),2).__str__()+suf print prettySize(213458923) # Output: 203.57M print prettySize(1234) # Output: 1.21K
import random, math class calcPi: def __init__(self): self.times = pow(10,6) self.i = 0 self.isnot = 0 def IsOnCircle(self,x,y): if math.sqrt(x**2+y**2) < 1: return True else: return False def run(self): for x in range(self.times): x,y = random.random(),random.random() if self.IsOnCircle(x,y): self.i+=1 else: self.isnot+=1 def getResults(self): return (float(self.i), float(self.isnot)) def getPi(self): self.run() r = self.getResults() return r[0]/(r[0]+r[1])*4 if __name__ == '__main__': print calcPi().getPi()
[++++++ ]
class Bar: def __init__(self): self.len = 80 self.chars = (' ', '+') self.wrap = ('[', ']') self.filledc = 0 def fill(self, i): assert not (i > 100) or (i < 0) self._setP(i) def _setP(self, p): self.filledc = int(round(float(self.len*p)/100)) def show(self): out = [] out.append(self.wrap[0]) out.append(self.filledc*self.chars[1]) out.append((self.len-self.filledc)*self.chars[0]) out.append(self.wrap[1]) return "".join(out) b = Bar() b.len = 20 b.fill(20) print b.show()