Skip to content

Instantly share code, notes, and snippets.

@higepon
higepon / gist:b4a0be68c6185c5f31e03b50d3339a4d
Created Jul 15, 2019
user css for kibela to hide some headers
View gist:b4a0be68c6185c5f31e03b50d3339a4d
.noteHeader-author { display: none }
.noteActionBar { display: none }
.noteHeader-groups { display: none }
.noteHeader-titleFooter { display: none }
.noteHeader-title {font-size: 20pt }
View gist:f12d4a9b774e8516d66eb2329618ab4e
Requirement already satisfied: easy-tf-log[tf] from git+https://github.com/mrahtz/easy-tf-log#egg=easy-tf-log[tf] in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: tensorflow in /usr/local/lib/python3.6/dist-packages (from easy-tf-log[tf])
Requirement already satisfied: protobuf>=3.4.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->easy-tf-log[tf])
Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->easy-tf-log[tf])
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from tensorflow->easy-tf-log[tf])
Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow->easy-tf-log[tf])
Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->easy-tf-log[tf])
Requirement already satisfied: gast>=0.2.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->easy-tf-log[tf])
Requirement already satisfie
@higepon
higepon / seq2seq.py
Last active Apr 15, 2020
Minimum Seq2Seq implementation using Tensorflow 1.4/1.5 API
View seq2seq.py
import numpy as np
import tensorflow as tf
from tensorflow.python.layers import core as layers_core
hparams = tf.contrib.training.HParams(
batch_size=3,
encoder_length=4,
decoder_length=5,
num_units=6,
src_vocab_size=7,
@higepon
higepon / gist:ba1af2e19e8ffcdb7f2a
Created Jul 14, 2015
Example of @IBDesignable without overdiding drawRect
View gist:ba1af2e19e8ffcdb7f2a
extension UIColor {
convenience init(hex: Int, alpha: CGFloat = 1.0) {
let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0
let green = CGFloat((hex & 0xFF00) >> 8) / 255.0
let blue = CGFloat((hex & 0xFF)) / 255.0
self.init(red:red, green:green, blue:blue, alpha:alpha)
}
}
@IBDesignable class AvatarView : UIImageView {
@higepon
higepon / Compatible.h
Created Jul 14, 2014
iOS7 and iOS8 Compatible Push Notifications Registrations
View Compatible.h
#import <Foundation/Foundation.h>
@interface Compatible : NSObject
+ (void)registerPush:(UIApplication *)application;
@end
@higepon
higepon / API.swift
Last active Aug 2, 2020
An example of JSON API call in Swift
View API.swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>
View gist:256a0e34576da3090b9a
class func createFromJson(roomObj: Dictionary<String, AnyObject>) -> Room! {
if let id = roomObj["id"]? as? Int {
if let name = roomObj["name"]? as? String {
if let userObj = roomObj["user"]? as? Dictionary<String, AnyObject> {
if let user = User.createGuestFromJson(userObj) {
if let messageCount = roomObj["message_count"]? as? Int {
if let isRemoved = roomObj["removed"]? as? Bool {
if let dateString = roomObj["created_at"]? as? String {
let formatter = NSDateFormatter()
View mige.json
{
"Twitter": "twitter://post?message=",
"directions to Twitter": "comgooglemaps://?saddr=&daddr=Suite+900:+1355+Market+St:+San+Francisco:+CA&directionsmode=transit",
"Twitter": "twitter://post?message=",
"Facebook": "fb://publish/?text=",
"home": "twitter://timeline",
"connect": "twitter://mentions",
"Gmail": "googlegmail://co?subject=&body=&to=higepon@gmail.com",
"camera": "camplus://",
"Foursquare": "foursquare://",
@higepon
higepon / ack
Created Dec 26, 2012
Use ack from Emacs. Wand to remove the last "interactive". Any suggestions?
View ack
(defun ack (directory keyword)
(setq default-directory (if (string= "dired-mode" major-mode)
(dired-current-directory)
(file-name-directory (buffer-file-name (current-buffer)))))
(interactive "D:What directory? \ns:keyword? ")
(grep-apply-setting 'grep-find-command (format "ack --nocolor --nogroup %s %s" keyword directory))
(call-interactively 'grep-find))
@higepon
higepon / gist:1574075
Last active Sep 29, 2015
brew install -v cdrtools
View gist:1574075
==> Downloading ftp://ftp.berlios.de/pub/cdrecord/cdrtools-3.00.tar.gz
File already downloaded in /Users/taro/Library/Caches/Homebrew
/usr/bin/tar xf /Users/taro/Library/Caches/Homebrew/cdrtools-3.00.tar.gz
==> smake INS_BASE=/usr/local/Cellar/cdrtools/3.00 INS_RBASE=/usr/local/Cellar/cdrtools/3.00 install
smake INS_BASE=/usr/local/Cellar/cdrtools/3.00 INS_RBASE=/usr/local/Cellar/cdrtools/3.00 install
==> Exit Status: 1
http://github.com/mxcl/homebrew/blob/master/Library/Formula/cdrtools.rb#L11
==> Environment k
HOMEBREW_VERSION: 0.8.1
HEAD: bcdce506a4eac512a258e2dc85bfa133623100ca