Skip to content

Instantly share code, notes, and snippets.

View sunshineatnoon's full-sized avatar

SunshineAtNoon sunshineatnoon

View GitHub Profile
  1. Install CMake 3.5.2 on CentOS 7

    Download Source distributions cmake-3.5.2.tar.gz from https://cmake.org/download/
    ./bootstrap
    gmake
    sudo gmake install
    
  2. Install libgpuarray on Centos 7

@sunshineatnoon
sunshineatnoon / Celery Learning.md
Created May 11, 2016 03:26
A memo on learning python library Celery
  1. Install Celery and RabbitMQ on MAC:
pip install celery
brew install rabbitmq
  1. Basic

Create folder celery_try and create file tasks.py.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

Draw histograms from list

import numpy as np
import matplotlib.pyplot as plt

count = [23, 44, 12, 11, 2, 10]
pos = np.arange(len(count))
width = 0.1     # gives histogram aspect to the bar diagram

Torch Notes

  1. How to use boolean variables in cmd:

cmd:option('--sample_patch', false, 'generate patch or image?')

So default is false, when one wants to turn that option on: th myfile.lua --sample_path

  1. Writing network architecture in option:

Install Mitsuba

Clone repo

https://github.com/yindaz/pbrs

Install Mitsuba

  • cd pbrs/mitsuba-af602c6fd98a
@sunshineatnoon
sunshineatnoon / tools.md
Last active March 3, 2019 04:09
Pytorch Tools

Loss Visualization

A loss plotter for multiple losses visualized in Visdom, draw different losses within the same window.

class loss_plotter():
    def __init__(self, port = 8097, server = "http://localhost"):
        self.vis = visdom.Visdom(port=port, server=server)
        assert self.vis.check_connection(timeout_seconds=3),'No connection could be formed quickly'
        self.losses = {}
        self.win = None
@sunshineatnoon
sunshineatnoon / dp.py
Last active January 1, 2022 17:44 — forked from zed/dp.py
Find height, width, and coordinates of the largest rectangle containing all 0's in the matrix
#!/usr/bin/env python
"""Find height, width of the largest rectangle containing all 0's in the matrix.
The algorithm for `max_size()` is suggested by @j_random_hacker [1].
The algorithm for `max_rectangle_size()` is from [2].
The Python implementation [3] is dual licensed under CC BY-SA 3.0
and ISC license.
[1]: http://stackoverflow.com/questions/2478447/find-largest-rectangle-containing-only-zeros-in-an-nn-binary-matrix#comment5169734_4671342