Skip to content

Instantly share code, notes, and snippets.

Jacob Greenleaf jacobgreenleaf

Block or report user

Report or block jacobgreenleaf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jacobgreenleaf
jacobgreenleaf / file.go
Created Jul 23, 2019
Golang code to replace something inline
View file.go
package main
import (
"fmt"
"go/ast"
"go/types"
_ "go/parser"
_ "go/token"
"golang.org/x/tools/go/loader"
"golang.org/x/tools/go/ast/astutil"
View gist:ec4155c1ca421b3911f2c88f251ae9ff
-- Logs begin at Thu 2018-05-24 06:37:54 UTC, end at Fri 2018-05-25 01:33:26 UTC. --
May 24 06:37:54 localhost systemd-journal[147]: Runtime journal is using 4.0M (max allowed 11.8M, trying to leave 17.8M free of 114.7M available → current limit 11.8M).
May 24 06:37:54 localhost systemd-journal[147]: Runtime journal is using 4.0M (max allowed 11.8M, trying to leave 17.8M free of 114.7M available → current limit 11.8M).
May 24 06:37:54 localhost kernel: Initializing cgroup subsys cpuset
May 24 06:37:54 localhost kernel: Initializing cgroup subsys cpu
May 24 06:37:54 localhost kernel: Initializing cgroup subsys cpuacct
May 24 06:37:54 localhost kernel: Linux version 3.16.0-4-amd64 (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07)
May 24 06:37:54 localhost kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64 root=UUID=328c1eeb-1a6f-4fa6-a850-b59782541c5c ro console=ttyS0,38400n8 elevator=noop
May 24 06:37:54 localhost kernel: e820: BIOS-pr
View keybase.md

Keybase proof

I hereby claim:

  • I am jacobgreenleaf on github.
  • I am jacobgreenleaf (https://keybase.io/jacobgreenleaf) on keybase.
  • I have a public key whose fingerprint is 48D2 D600 A17E D2A7 A71C 5185 59E3 175B 70F4 1247

To claim this, I am signing this object:

View gist:ed4c59865164de10b41c
+----------+----------+
| google | reddit |
+----------+----------+
google | 1 | |
reddit | 1 | 1 |
+---------------------+
HBase:
google:google:1
View gist:69ebc6a3ad245da4c513
| google.com | reddit.com |
+--------------+--------------+
google.com | 1 | 0 |
reddit.com | 1 | 1 |
+-----------------------------+
View gist:9b3ded57011593b6b884
$ curl 'https://chromeperf.appspot.com/components/chart-tooltip.html' -i -H 'origin: https://chromeperf.appspot.com' -H 'accept-encoding: gzip,deflate' -H 'accept-language: en-US,en;q=0.8' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36' -H 'accept: */*' -H 'cache-control: max-age=0' -H 'cookie: _gat=1; _ga=GA1.3.1458285460.1437500436' -H 'referer: https://chromeperf.appspot.com/components/chart-container.html' --compressed 2>/dev/null | head -n 250 | tail -n 10
200);
},
setPosition(top, left) {
this.$.container.style.top = top + 'px';
this.$.container.style.left = left + 'px';
}
});
</script>
View gist:7b09ba6bf466d2f2bfab
$ curl 'https://chromeperf.appspot.com/components/chart-tooltip.html' -i -H 'if-none-match: "1pjMZA"' -H 'origin: https://chromeperf.appspot.com' -H 'accept-encoding: gzip,deflate' -H 'accept-language: en-US,en;q=0.8' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36' -H 'accept: */*' -H 'cache-control: max-age=0' -H 'cookie: _gat=1; _ga=GA1.3.1458285460.1437500436' -H 'referer: https://chromeperf.appspot.com/components/chart-container.html' --compressed
HTTP/1.1 304 Not Modified
Date: Tue, 21 Jul 2015 19:05:30 GMT
Expires: Tue, 21 Jul 2015 19:15:30 GMT
Cache-Control: public, max-age=600
ETag: "1pjMZA"
Server: Google Frontend
Alternate-Protocol: 443:quic,p=1
View gist:fe69abe9df030179ba44
class CachePolicy
{
public function __construct($cache, $model)
{
$this->cache = $cache;
$this->model = $model;
$this->cached_methods = array();
}
public function wraps($method, $args, $prefix = 'cache::')
View gist:7ee13114bf4e2a859a60
return Cache::instance()->check_and_set(array($x, $y, $z), 3600, function() {
do some work
return $value;
});
View gist:72eee60ecf5e4a39b914
$cache_key = 'aaaa_$x_$y_$z';
if($nocache || $cache_value = Cache::instance()->get($cache_key)) {
return $cache_value;
}
do work
Cache::instance()->set($cache_key, $something, 3600);
return $something;
You can’t perform that action at this time.