Skip to content

Instantly share code, notes, and snippets.

View tmandry's full-sized avatar

Tyler Mandry tmandry

View GitHub Profile
@jart
jart / blakefiler.py
Last active September 18, 2023 16:22
Turns bazel query --output=build //tensorflow:libtensorflow_framework.so into isomorphic Makefile
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@ldez
ldez / gmail-github-filters.md
Last active April 3, 2024 11:53
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@Ashton-W
Ashton-W / Extra Logging for My Great App.mobileconfig
Created October 26, 2016 22:55 — forked from zwaldowski/Extra Logging for My Great App.mobileconfig
Apple Configuration Profile for Logging in iOS 10 and macOS Sierra
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- iOS 10, macOS Sierra, and friends bring a new logging subsystem that's
supposed to scale from the kernel, up to frameworks, and up to apps. It defaults
to a more regimented, privacy-focused approach that large apps and complex
systems need.
It, along with Activity Tracing introduced in iOS 8 and macOS Yosemite and the
Console app in macOS Sierra, hope to help you graduate from caveman debugging to
@rajarsheem
rajarsheem / newton optimization.py
Created June 6, 2016 22:19
Newton's optimization method for multivariate function in tensorflow
import numpy as np
import tensorflow as tf
# Newton's optimization method for multivariate function in tensorflow
def cons(x):
return tf.constant(x, dtype=tf.float32)
def compute_hessian(fn, vars):
mat = []
@nicklockwood
nicklockwood / gist:21495c2015fd2dda56cf
Last active August 13, 2020 13:57
Thoughts on Swift 2 Errors

Thoughts on Swift 2 Errors

When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.

So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.

Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?

I'm going to cover three things in this post:

@calebd
calebd / ArrayHelpers.swift
Last active November 4, 2022 15:17
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@knutwalker
knutwalker / README.md
Last active April 19, 2023 16:17
Git commit graph to Neo4j

Installation

  • requires python 2.7 (maybe python 3.3+ will work too, didn't tested it)

Put git2neo.py somewhere in your $PATH and chmod +x it.

Usage

@dreadatour
dreadatour / gist:7475747
Created November 14, 2013 22:51
Remove default Sublime Text 3 snippets
# Sublime Text 3 languages list:
ls -1 /Applications/Sublime\ Text.app/Contents/MacOS/Packages/
# Remove all default Sublime Text 3 snippets for Python language
export ST3_LANG="Python"
mkdir -p ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/$ST3_LANG/
unzip -l /Applications/Sublime\ Text.app/Contents/MacOS/Packages/$ST3_LANG.sublime-package | grep '.sublime-snippet' | awk '{print $4}' | while read f; do touch ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/$ST3_LANG/$f; done
unset ST3_LANG
@joshdover
joshdover / application.html.erb
Last active December 25, 2015 03:49
Rails helper for automatically generating mixpanel tracking for links.
<!-- Include Mixpanel and init before this. -->
<!-- Place at the bottom of your layout (ex: app/views/layouts/application.html.erb) -->
<% if content_for :mixpanel %>
<%= javascript_tag(yield :mixpanel) %>
<% end %>
@avimar
avimar / gist:5968480
Created July 10, 2013 17:47
Install newrelic with salt-stack on your debian/ubuntu system
#install instructions at https://newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian
base:
pkgrepo.managed:
- humanname: Newrelic PPA
- name: deb http://apt.newrelic.com/debian/ newrelic non-free
# - dist: precise
- file: /etc/apt/sources.list.d/newrelic.list
- keyid: 548C16BF
- keyserver: subkeys.pgp.net