Skip to content

Instantly share code, notes, and snippets.

@nkcr
nkcr / implementing-a-cnn-for-text-classification.ipynb
Last active May 28, 2018 11:11
Implementing a CNN for Text Classification.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nkcr
nkcr / timelapse.md
Created July 4, 2016 17:38
Export a timelapse using ffmpeg

With FFMPEG

ffmpeg -r 24 -start_number 6885 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4 -crf 18 -preset slow
@nkcr
nkcr / premailer-rails.rb
Created May 23, 2016 11:22
Manually inline css using premailer-rails
# Inside a controller
mail = Premailer::Rails::Hook.new(NewsMailer.news(@newsletter, params[:email]))
mail.perform
mail.message.html_part.body.decoded # Gives plain inlined HTML
@nkcr
nkcr / contact.xsd
Last active May 11, 2016 12:53
contact.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Main instance -->
<xs:element name="contact">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<!-- Title, firstname, lastname -->
<xs:element name="title" type="titleType"/>
<xs:element name="firstname" type="xs:string"/>
<?xml version="1.0" encoding="utf-8" ?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
@nkcr
nkcr / AbstractFacade.java
Created March 11, 2016 12:04 — forked from Snugglepantz/AbstractFacade.java
Modified Netbeans Abstract Facade
package me.slashfix.angular.rest;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.Query;
/**
@nkcr
nkcr / fast rsync.md
Last active February 25, 2016 21:04

rsync version 3.1.2

rsync -a --progress --stats --human-readable -e "ssh -T -c arcfour -o Compression=no -x" <source> <destination>

https://gist.github.com/KartikTalwar/4393116

  • -a archive mode
  • --progress --human-readable show progress in readble manner
@nkcr
nkcr / opencv.md
Last active January 22, 2022 17:06
Install opencv on mac

Install opencv3 with brew

brew tap homebrew/science
brew install opencv3

Be sure to have pkg-config, otherwise install it:
brew install pkg-config

be sure to have pkg-config var set correctly

gem build  blabla.gemspec
gem push blabla.gem

npm
require 'date'
# Actually doesn't matter WHAT you choose as the epoch, it
# won't change the algorithm. Just don't change it after you
# have cached computed scores. Choose something before your first
# post to avoid annoying negative numbers. Choose something close
# to your first post to keep the numbers smaller. This is, I think,
# reddit's own epoch.
$our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time