This file contains 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 subprocess | |
import os | |
def convert_gtzan_to_mp3(gtzan_folder_path, output_folder_name): | |
# recursively walk through the directory | |
for dirpath, dirnames, filenames in os.walk(gtzan_folder_path): | |
for filename in filenames: | |
input_filepath = os.path.join(dirpath, filename) | |
output_folderpath = dirpath.replace(gtzan_folder_path, output_folder_name) |
This file contains 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
sox input.wav -r 16k output.wav |
This file contains 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
# from : http://pytorch.org/docs/master/notes/autograd.html | |
# pretrained models here : https://github.com/pytorch/vision/tree/master/torchvision/models | |
model = torchvision.models.resnet18(pretrained=True) | |
for param in model.parameters(): | |
param.requires_grad = False | |
# Replace the last fully-connected layer | |
# Parameters of newly constructed modules have requires_grad=True by default | |
model.fc = nn.Linear(512, 100) | |
# Optimize only the classifier |
This file contains 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
root = 'imagenet' | |
traindir = 'train' | |
image_dataset = ImageFolder( | |
traindir, | |
transform=transforms.Compose([ | |
transforms.RandomResizedCrop(224), | |
transforms.RandomHorizontalFlip(), | |
transforms.ToTensor(), | |
transforms.Normalize(mean=[0.485, 0.456, 0.406], | |
std=[0.229, 0.224, 0.225]), |
This file contains 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
var allPerms = []; | |
function permutation(list, ret) | |
{ | |
if (list.length == 0) { | |
allPerms.push(ret); // return the result | |
return; | |
} | |
for (var i = 0; i < list.length; i++) { |
This file contains 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 poj() { | |
g++-6 -Wall -std=c++98 -pedantic-errors $1; | |
cat input.txt | ./a.out | |
} |
This file contains 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/bash | |
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html | |
sudo rm -rf /Library/Frameworks/GHC.framework | |
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework | |
sudo rm -rf /Library/Haskell | |
rm -rf .cabal | |
rm -rf .ghc | |
rm -rf ~/Library/Haskell |
This file contains 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/bash | |
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html | |
sudo rm -rf /Library/Frameworks/GHC.framework | |
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework | |
sudo rm -rf /Library/Haskell | |
rm -rf .cabal | |
rm -rf .ghc | |
rm -rf ~/Library/Haskell |
This file contains 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
curl -F ‘data=@path/to/file.txt’ https://localhost/upload/ |
This file contains 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
curl --http2 -k -v https://localhost/get/ |
OlderNewer