Skip to content

Instantly share code, notes, and snippets.

View YukiNagato's full-sized avatar

Siyuan Yang YukiNagato

  • Suzhou, China
View GitHub Profile
//c++11
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
#include <assert.h>
#include <ctime>
#include <cstdio>
#include <functional>
@YukiNagato
YukiNagato / waya-dl-setup.sh
Created April 30, 2019 13:25 — forked from mjdietzx/waya-dl-setup.sh
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/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
@YukiNagato
YukiNagato / BGRA2RGBA
Created March 25, 2019 07:27 — forked from micahpearlman/BGRA2RGBA
BGRA to RGBA
// 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
@YukiNagato
YukiNagato / infinite_dataloader.py
Created March 4, 2019 01:56 — forked from MFreidank/infinite_dataloader.py
A pytorch DataLoader that generates an unbounded/infinite number of minibatches from the dataset.
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):
@YukiNagato
YukiNagato / dict_merge.py
Created March 1, 2019 06:47 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
# 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
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
# 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]
b = type('', (), {})()
obj = lambda: None
import types
x = types.SimpleNamespace()
# 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])
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