Skip to content

Instantly share code, notes, and snippets.

@alanpeabody
alanpeabody / my_app.ex
Last active March 24, 2024 13:28
Websockets in Elixir with Cowboy and Plug
defmodule MyApp do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
Plug.Adapters.Cowboy.child_spec(:http, MyApp.Router, [], [
dispatch: dispatch
])
@lembacon
lembacon / luna_pinyin.emoji.dict.yaml
Last active November 20, 2023 16:09
Pinyin-Emoji Dictionary for Squirrel
# Rime dictionary
# encoding: utf-8
---
name: luna_pinyin.emoji
version: "2017.02.10"
sort: by_weight
use_preset_vocabulary: true
...
@gburd
gburd / async_nif.h
Last active October 3, 2023 05:12
Technique for running Erlang NIFs functions asynchronously, not on scheduler threads.
/*
* async_nif: An async thread-pool layer for Erlang's NIF API
*
* Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
* Author: Gregory Burd <greg@basho.com> <greg@burd.me>
*
* This file is provided to you 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:
*
@dulacp
dulacp / libjpeg.sh
Created February 28, 2015 00:57
Download & Compile Libjpeg for iOS (all architectures)
# Builds a Libjpeg framework for the iPhone and the iPhone Simulator.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using libjpeg in Xcode
# less painful.
#
# To configure the script, define:
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1)
#
# Then go get the source tar.bz of the libjpeg you want to build, shove it in the
# same directory as this script, and run "./libjpeg.sh". Grab a cuppa. And voila.
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
@MatthiasWinkelmann
MatthiasWinkelmann / Tensorflow_Build_GPU.md
Last active May 20, 2019 15:21 — forked from smitshilu/Tensorflow_Build_GPU.md
Tensorflow 1.7 Mac OS Sierra 10.12 GPU Support

Tensorflow

System information

  • OS - Sierra 10.12
  • Tensorflow - 1.7.0
  • Xcode command line tools - 8.2 (Download from here: Xcode - Support - Apple Developer & Switch to different clang version: sudo xcode-select --switch/Library/Developer/CommandLineTools & check version: clang -v)
  • Cmake - 3.11
  • Bazel - 0.11.1
@grantr
grantr / curvecp_handshake.rb
Last active July 19, 2018 15:16
CurveCP handshake protocol in Ruby
# A demonstration of the CurveCP handshake protocol. This protocol has many
# favorable security properties described at http://curvecp.org.
#
# In addition to its security advantages, it has the following favorable properties:
# * Needs only 2 messages (1 from client, 1 from server) before application
# messages can be exchanged (3 before the server can send application messages)
# * Does not require the server to keep protocol state between handshake messages.
#
# An overview of the protocol:
#
@AndrewRadev
AndrewRadev / diffsplit.vim
Last active May 22, 2018 14:45
Split a git diff in separate files to mirror the original repo layout
" Put this in plugin/diffsplit.vim.
"
" Executing :Diffsplit on a file, containing a git diff would open up a new
" tab, cd to a temporary directory, and distribute the changes into separate
" files, mirroring the repo layout. You can then use NERDTree or whatever you
" like to browse through the changes.
"
" Using it straight from the command-line is fairly simple and aliasable:
"
" git diff whatever | vim - -R +Diffsplit