Skip to content

Instantly share code, notes, and snippets.

View ashwin's full-sized avatar

Ashwin Nanjappa ashwin

View GitHub Profile
@ashwin
ashwin / rotate_point_opencv.cpp
Created June 16, 2015 09:58
Rotate point in OpenCV
cv::Point2f RotatePoint(const cv::Point2f& p, float rad)
{
const float x = std::cos(rad) * p.x - std::sin(rad) * p.y;
const float y = std::sin(rad) * p.x + std::cos(rad) * p.y;
const cv::Point2f rot_p(x, y);
return rot_p;
}
cv::Point2f RotatePoint(const cv::Point2f& cen_pt, const cv::Point2f& p, float rad)
@ashwin
ashwin / getconf_vars.txt
Created June 4, 2015 09:59
getconf variables that I find useful
# Note: These are on my system. Values will vary on your system.
# Bits occupied by primitive types
CHAR_BIT 8
LONG_BIT 64
# Limits of signed types
CHAR_MAX 127
CHAR_MIN -128
INT_MAX 2147483647
@ashwin
ashwin / eigen_opencv.cpp
Created June 2, 2015 09:51
Eigen vectors and eigen values in OpenCV
#include <opencv/cv.h>
// Input mat: 100 6-dimensional points
// Rows: 100 Cols: 6 Type: CV_F32
cv::Mat pt_mat;
cv::PCA pt_pca(pt_mat, cv::Mat(), CV_PCA_DATA_AS_ROW, 0);
// Mean
// Rows: 1 Cols: 6
@ashwin
ashwin / eclipse_exclude.xml
Created June 2, 2015 09:03
XML code added by Eclipse CDT on excluding a zoomba directory
<filteredResources>
<filter>
<id>1433235573506</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-zoomba</arguments>
</matcher>
</filter>
@ashwin
ashwin / gist:0e05b37aa13126669ee2
Created May 21, 2015 09:48
Empty recycle bin of all users in Windows
C:> rd /s C:\$Recycle.Bin
@ashwin
ashwin / doi_to_bibtex.sh
Created May 6, 2015 11:54
Get BibTeX from DOI passed as input
#!/bin/bash
url="http://dx.doi.org/"$1
curl -LH 'Accept: application/x-bibtex' $url
@ashwin
ashwin / set_asciidoctor_themes.vim
Created May 4, 2015 05:50
Set themes directory for ASCIIDoctor in Vim
" Set themes directory for ASCIIDoctor in Vim
let g:asciidoctor_themes_dir='~/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/asciidoctor-1.5.2/data/stylesheets'
@ashwin
ashwin / set_asciidoc_compiler.vim
Created May 4, 2015 05:48
Set compiler in Vim for ASCIIDoc files
" Vim-Asciidoc plugin sets compiler by default to asciidoc
" Here we set it to asciidoctor
autocmd Filetype asciidoc compiler asciidoctor
@ashwin
ashwin / async_example.cpp
Last active March 3, 2023 23:18
How to use async threads in C++
#include <future>
float DoWork(int idx)
{
// Do some hard computation using idx
// and internal read-only data structures
// Return the float result
}
void DoAsync()
@ashwin
ashwin / nvidia_panic.txt
Created March 30, 2015 12:44
Kernel panic error seen on display with NVIDIA driver
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffff8172762b>] __down_common+0x4c/0x144
PGD 608b48067 PUD 60ba27067 PMD 0
Oops: 0002 [#1] SMP
Modules linked in: ath3k btusb bluetooth mxm_wmi x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel arc4 kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul ath9k glue_helper ablk_helper cryptd ath9k_common ath9k_hw joydev ath mac80211 serio_raw snd_hda_intel(+) rtsx_pci_ms lpc_ich(+) snd_seq_midi memstick cfg80211 snd_seq_midi_event snd_hda_codec snd_hwdep snd_rawmidi snd_pcm parport_pc snd_page_alloc snd_seq mei_me(+) mei ppdev snd_seq_device snd_timer snd nvidia(POX+) lp i915(+) parport video drm_kms_helper soundcore wmi drm mac_hid shpchp i2c_algo_bit hid_generic usbhid hid rtsx_pci_sdmmc ahci r8169 psmouse libahci mii rtsx_pci
CPU: 0 PID: 527 Comm: nvidia-persiste Tainted: P OX 3.13.0-44-generic #73-Ubuntu
Hardware name: Notebook W35xSTQ_370ST