Skip to content

Instantly share code, notes, and snippets.

Avatar

Yann Kerhervé yannk

  • San Francisco, CA, USA
View GitHub Profile
View gist:b275658025481d25a17d
#line 18 "/home/yann/src/github.com/svent/sift/matching_cgo.go"
#include <stddef.h>
inline int count_newlines(const unsigned char *buf, size_t n) {
int count = 0;
int base;
int dist = n / 4;
View gist:9552864
I hereby claim:
* I am yannk on github.
* I am yann (https://keybase.io/yann) on keybase.
* I have a public key whose fingerprint is 1627 70E0 5CFF B8D0 26D7 46B1 130E E965 1C32 A1B7
To claim this, I am signing this object:
```json
@yannk
yannk / gist:6289094
Last active Dec 21, 2015
Sendgrid bug in the parse api. mangled text data if it's containing high-bit characters.
View gist:6289094

Sendgrid seems to have a bug in the Parse api. The fields are inconsistently encoded. According to the docs, they all should be UTF-8, but they are not.

I sent an email to the parse endpoint with the subject and the body containing: 日本国.

The text one below is incorrect (not utf-8)

Here is a capture of the data on the wire:

  5a 59 0d 0a 43 6f 6e 74    65 6e 74 2d 44 69 73 70    ZY..Content-Disp
  6f 73 69 74 69 6f 6e 3a    20 66 6f 72 6d 2d 64 61    osition: form-da
View gist:6093577
traceroute to 8.18.203.20 (8.18.203.20), 64 hops max, 52 byte packets
1 tomato (192.168.104.254) 10.725 ms 96.718 ms 9.811 ms
2 gw-200paulnorth-v302 (199.116.72.65) 10.868 ms 32.855 ms 28.515 ms
3 grillo.grillo-piojo.core.monkeybrains.net (208.69.43.170) 32.149 ms 79.456 ms 33.467 ms
4 guava.guava-grillo.core.monkeybrains.net (208.69.43.137) 69.386 ms 67.691 ms 123.768 ms
5 kiwi.kiwi-abeja.core.monkeybrains.net (208.69.43.133) 116.996 ms 33.340 ms 67.061 ms
6 guava.guava-grillo.core.monkeybrains.net (208.69.43.137) 41.047 ms 15.937 ms 19.915 ms
....
View gist:5259208
Ember.Route.reopen({
enter: function() {
this._super();
var cssClass = this.toCssClass();
if (cssClass === 'application') return; // not interesting to us
Ember.$('body').addClass(cssClass);
},
exit: function() {
this._super();
Ember.$('body').removeClass(this.toCssClass());
View gist:275688
console full=yes
console address=127.0.0.1:4000
socket httpsock host=127.0.0.1
socket httpsock service=5000
proxy httpproxy cmd=perl -I/Users/miyagawa/dev/Nomo/lib /Users/miyagawa/dev/Nomo/bin/nomo-cfk-proxy.pl /Users/miyagawa/dev/Plack/eg/dot-psgi/Hello.psgi
proxy httpproxy service plack1 tie_stdin_to=httpsock
proxy httpproxy service plack2 tie_stdin_to=httpsock
View gist:275687
console full=yes
console address=127.0.0.1:4000
socket httpsock host=127.0.0.1
socket httpsock service=5000
service plack cmd=perl -I/Users/miyagawa/dev/Nomo/lib /Users/miyagawa/dev/Nomo/bin/nomo /Users/miyagawa/dev/Plack/eg/dot-psgi/Hello.psgi
proxy httpproxy service plack tie_stdin_to=httpsock
command bind httpsock
View gist:210746
package Plack::Server::Standalone::Accept;
use strict;
use warnings;
use base qw(Plack::Server::Standalone);
use IO::Socket::INET;
sub setup_listener {
my $self = shift;
open my $socket, "<&=0"
View gist:199066
--- lib/AnyEvent/orig.pm 2009-10-01 08:55:59.000000000 -0700
+++ lib/AnyEvent/Util.pm 2009-10-01 09:02:05.000000000 -0700
@@ -537,6 +537,10 @@
See C<close_all_fds_except> for more details.
+=item pidref => \$scalar
+
+A reference to a scalar where to store the pid of the run command.
+
View gist:198754
--- orig.pm 2009-09-30 22:58:25.000000000 -0700
+++ ../lib/AnyEvent/Util.pm 2009-09-30 22:58:04.000000000 -0700
@@ -468,10 +468,12 @@
=item $cv = run_cmd $cmd, key => value...
-Run a given external command, potentially redirecting file descriptors and
-return a condition variable that gets sent the exit status (like C<$?>)
-when the program exits I<and> all redirected file descriptors have been
-exhausted.
You can’t perform that action at this time.