Skip to content

Instantly share code, notes, and snippets.

@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;
/**
<?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 / 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"/>
@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 / 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 / implementing-a-cnn-for-text-classification.ipynb
Last active May 28, 2018 11:11
Implementing a CNN for Text Classification.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nkcr
nkcr / implementing-a-cnn-for-text-classification.ipynb
Last active May 28, 2018 11:20
Implementing a CNN for Text Classification.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nkcr
nkcr / image-from-pattern.md
Last active June 8, 2018 09:13
Generate big image from a pattern
$ docker run -v ${PWD}:/images --rm -it v4tech/imagemagick /bin/sh
/ # convert -size 2970x2100 tile:images/pattern.png images/big.png
#!/bin/bash
DEST_DIR=~/picam
SHM_DIR=/run/shm
mkdir -p $SHM_DIR/rec
mkdir -p $SHM_DIR/hooks
mkdir -p $SHM_DIR/state
mkdir -p $DEST_DIR/archive
ln -sfn $DEST_DIR/archive $SHM_DIR/rec/archive
for f in ./*.jpg; do
        /Users/nkcr/Downloads/libwebp-1.0.2-rc1-mac-10.14/bin/cwebp -q 80 $f -o $f.webp
done