Skip to content

Instantly share code, notes, and snippets.

@i-Hun
i-Hun / lirc-pi3.txt
Created May 30, 2019 21:50 — forked from prasanthj/lirc-pi3.txt
Getting lirc to work with Raspberry Pi 3 (Raspbian Stretch)
Notes to make IR shield (made by LinkSprite) work in Raspberry Pi 3 (bought from Amazon [1]).
The vendor has some documentation [2] but that is not complete and sufficient for Raspbian Stretch.
Following are the changes that I made to make it work.
$ sudo apt-get update
$ sudo apt-get install lirc
# Add the following lines to /etc/modules file
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17
@i-Hun
i-Hun / getfit.py
Created May 18, 2018 10:01 — forked from cedricbonhomme/getfit.py
Get your Google Fit data
#! /usr/bin/env python
#-*- coding: utf-8 -*-
import json
import httplib2
from datetime import datetime
from apiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow

Keybase proof

I hereby claim:

  • I am i-hun on github.
  • I am ihun (https://keybase.io/ihun) on keybase.
  • I have a public key ASBhm2M2hPPzVOZOB5EsVjOVTZquRH3ud-vu3GHQpELyKAo

To claim this, I am signing this object:

from __future__ import division
from gensim import corpora, models, similarities, matutils
import numpy as np
import scipy.stats as stats
from scipy.sparse import linalg as splinalg
from scipy.sparse import *
import matplotlib.pyplot as plt
import h5py
from pymongo import MongoClient
@i-Hun
i-Hun / JS: prototype and arguments
Last active December 19, 2015 21:39
JS: prototype and arguments
# Prototype
http://habrahabr.ru/post/117868/
arguments -- переменная, доступная внутри функции и содержащая аргументы и ссылку на саму функцию.
Несмотря на доступ по индексу и наличие свойства length, arguments не является массивом, т.е не принадлежит типу Array.
Поэтому для arguments нельзя напрямую вызвать методы этого класса:
arguments.pop() // ошибка !
Можно, однако, вызвать методы Array через apply/call:
var args = Array.prototype.slice.call(arguments, 0) //Мы вызываем метод slice прототипа Array от лица arguments.
@i-Hun
i-Hun / JS: анонимные самовызывающиеся функции
Created July 17, 2013 16:09
JS: анонимные самовызывающиеся функции
http://stackoverflow.com/questions/1122690/jquery-and-questions/1122740#1122740
Let's rewrite this code a little bit to understand what's going on.
function complicatedFunction($) {
// the document.ready call goes here.
}
Next, how would you call this function?
complicatedFunction(someObject);
So inside the complicatedFunction $ refers to someObject. Agree?
@i-Hun
i-Hun / gist:6018951
Created July 17, 2013 08:56
On ready patterns in Meteor
var eventsHandle = Meteor.subscribe('events');
var onReady = Deps.autorun(function () {
eventsHandle.ready();
});
onReady.onInvalidate(function() {
Events.find().observeChanges({
_suppress_initial: true,
added: function(id, event) {
Не сразу понял, как в meteor выполнить сортировку по вложенным свойствам. Надо всего лишь взять их в кавычки:
Events.find({}, {sort: {"properties.title": 1}});
Это правило применимо к mongoDB в целом.
@i-Hun
i-Hun / gist:5730263
Created June 7, 2013 15:49
Meteor: how to access parent properties within nested templates?
Template.nestedTemplate.events({
'click a.class':function(event,template){
var parentID = template.data._id;
console.log(parentID);
}
});
//http://stackoverflow.com/questions/13091914/meteor-how-to-access-parent-properties-within-nested-templates
@i-Hun
i-Hun / gist:5643872
Created May 24, 2013 14:23
The process for doing this for GitHub is to first create a new repository, then follow the standard practice to get the package's code within that repository.
$ git init
$ git add -A
$ git commit -m "Created Errors Package"
$ git remote add origin https://github.com/tmeasday/meteor-errors.git
$ git push origin master