Skip to content

Instantly share code, notes, and snippets.

@j314erre
j314erre / text_cnn.py
Created July 13, 2016 00:00
load pre-trained word2vec into cnn-text-classification-tf
import tensorflow as tf
import numpy as np
class TextCNN(object):
"""
A CNN for text classification.
Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer.
"""
def __init__(
@danijar
danijar / blog_tensorflow_variable_sequence_labelling.py
Last active May 15, 2022 14:28
TensorFlow Variable-Length Sequence Labelling
# Working example for my blog post at:
# http://danijar.com/variable-sequence-lengths-in-tensorflow/
import functools
import sets
import tensorflow as tf
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import rnn
def lazy_property(function):
@danijar
danijar / blog_tensorflow_sequence_labelling.py
Last active January 12, 2024 15:18
TensorFlow Sequence Labelling
# Example for my blog post at:
# http://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@keicoder
keicoder / snippet.m
Created January 28, 2014 04:49
objective-c : UIKit Customization (navBar, barButton, slider, etc)
//UIKit Customization
//.h
- (void)customizeAppearance;
//.m
- (void)customizeAppearance
{
@SavvyGuard
SavvyGuard / botos3upload.py
Last active September 10, 2024 06:53
Use boto to upload directory into s3
import boto
import boto.s3
import os.path
import sys
# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = ''
AWS_ACCESS_KEY_SECRET = ''
# Fill in info on data to upload
@chourobin
chourobin / RKAppDelegate.m
Last active October 22, 2018 14:22
Setting up magical record with RestKit
#import <RestKit/RestKit.h>
#import "CoreData+MagicalRecord.h"
// Use a class extension to expose access to MagicalRecord's private setter methods
@interface NSManagedObjectContext ()
+ (void)MR_setRootSavingContext:(NSManagedObjectContext *)context;
+ (void)MR_setDefaultContext:(NSManagedObjectContext *)moc;
@end
@implementation AppDelegate
@mocobeta
mocobeta / QueryTest.java
Last active June 10, 2016 21:57
Lucene 4.1 querying sample
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@ghawkgu
ghawkgu / gist:4621586
Last active April 5, 2018 20:25
Intercept the request of uiwebview, add customized header in the request. For detailed info, read http://www.nomadplanet.fr/2010/09/custom-http-headers-for-every-request-made-in-uiwebviews/ .
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)aRequest navigationType:(UIWebViewNavigationType)navigationType {
NSDictionary *headers = [aRequest allHTTPHeaderFields];
BOOL hasWhateverAddedHeader = NO;
for(NSString *key in [headers allKeys]) {
if([[key lowercaseString] isEqualToString:@"my-added-header"]) {
hasWhateverAddedHeader = YES;
break;
}
}
@misterbrownlee
misterbrownlee / jenkins-notes.md
Created September 12, 2012 18:10
Jenkins setup

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins