This file contains hidden or 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
| //c++11 | |
| #include <cmath> | |
| #include <iostream> | |
| #include <map> | |
| #include <vector> | |
| #include <assert.h> | |
| #include <ctime> | |
| #include <cstdio> | |
| #include <functional> |
This file contains hidden or 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 | |
| # install CUDA Toolkit v8.0 | |
| # instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network)) | |
| CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb" | |
| wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG} | |
| sudo dpkg -i ${CUDA_REPO_PKG} | |
| sudo apt-get update | |
| sudo apt-get -y install cuda |
This file contains hidden or 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
| // Really awesome code taken from: http://apangborn.com/2011/05/pixel-processing-using-arm-assembly/ | |
| inline static void neon_rgba_to_bgra(unsigned char *src, unsigned char *dst, int numPixels) | |
| { | |
| #ifdef __ARM_NEON__ | |
| int simd_pixels = numPixels & ~7; // round down to nearest 8 | |
| int simd_iterations = simd_pixels >> 3; | |
| int col; | |
| if(simd_iterations) { // make sure at least 1 iteration | |
| __asm__ __volatile__ ("1: \n\t" | |
| // structured load of 8 pixels into d0-d3 (64-bit) NEON registers |
This file contains hidden or 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 torch.utils.data import DataLoader | |
| class InfiniteDataLoader(DataLoader): | |
| def __init__(self, *args, **kwargs): | |
| super().__init__(*args, **kwargs) | |
| # Initialize an iterator over the dataset. | |
| self.dataset_iterator = super().__iter__() | |
| def __iter__(self): |
This file contains hidden or 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
| # Recursive dictionary merge | |
| # Copyright (C) 2016 Paul Durivage <[email protected]> | |
| # | |
| # This program is free software: you can redistribute it and/or modify | |
| # it under the terms of the GNU General Public License as published by | |
| # the Free Software Foundation, either version 3 of the License, or | |
| # (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains hidden or 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
| rm -Rf /Applications/Android\ Studio.app | |
| rm -Rf ~/Library/Preferences/AndroidStudio* | |
| rm -Rf ~/Library/Preferences/com.google.android.* | |
| rm -Rf ~/Library/Preferences/com.android.* | |
| rm -Rf ~/Library/Application\ Support/AndroidStudio* | |
| rm -Rf ~/Library/Logs/AndroidStudio* | |
| rm -Rf ~/Library/Caches/AndroidStudio* | |
| rm -Rf ~/.AndroidStudio* | |
| rm -Rf ~/AndroidStudioProjects | |
| rm -Rf ~/.gradle |
This file contains hidden or 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
| # https://stackoverflow.com/questions/3462143/get-difference-between-two-lists | |
| # 1 | |
| set([1, 2]) - set([2, 3]) # set(1) | |
| set([1, 2]).symmetric_difference(set([2, 3])) #set(1, 3) | |
| # 2 | |
| s = set(temp2) | |
| temp3 = [x for x in temp1 if x not in s] |
This file contains hidden or 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
| b = type('', (), {})() | |
| obj = lambda: None | |
| import types | |
| x = types.SimpleNamespace() |
This file contains hidden or 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
| # https://stackoverflow.com/a/24960300 | |
| numbers = [ 0.7653, 10.2, 100.2325, 500.9874 ] | |
| for n in numbers: | |
| print('{:.6s}'.format('{:0.4f}'.format(n))) | |
| print('%.6s' % ('%.4f' % n)) | |
| print(('%.4f' % n)[:6]) |
This file contains hidden or 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
| 1) Edit the .gitmodules file, and change the URL for the submodules which changed. | |
| 2) In your source tree’s root run: | |
| user@host:/path/to/repo$ git submodule sync | |
| 3) Then run git init to update the project’s repository configuration with the new URLs: | |
| user@host:/path/to/repo$ git submodule init |
NewerOlder