Skip to content

Instantly share code, notes, and snippets.

View castaneai's full-sized avatar
🥳
Watching anime

castaneai castaneai

🥳
Watching anime
View GitHub Profile
@castaneai
castaneai / client.go
Created July 29, 2019 03:25
[gRPC Channelz] show trace on client connection
package main
import (
"context"
"github.com/golang/protobuf/ptypes"
"google.golang.org/grpc/reflection"
"log"
"net"
"os"
"time"
@castaneai
castaneai / tbf06.gs
Created March 18, 2019 14:22
tbf06 checked count
function fetch() {
var headers = {"Cookie": "user=xxxxxxxxxxxxxxxxxx;"}; // <- insert your cookie here
var params = {
"method": "GET",
"headers": headers,
};
var url = "https://techbookfest.org/api/circle/own";
var resp = UrlFetchApp.fetch(url, params);
return JSON.parse(resp.getContentText());
}
@castaneai
castaneai / std_function_typedef.cpp
Created July 8, 2014 13:14
typedef std function
#include <iostream>
#include <functional>
typedef std::function<void()> ThreadFunc;
int main(){
ThreadFunc a = []{};
a();
return 0;
}
@castaneai
castaneai / migrate-repo.sh
Created January 8, 2019 02:57
Migrating private repo to GitHub from GitLab.
#!/bin/bash
GITLAB_USER=castaneai
GITHUB_USER=castaneai
REPO_NAME=$1
git clone --mirror https://gitlab.com/$GITLAB_USER/$REPO_NAME && cd $REPO_NAME.git && hub create -p $REPO_NAME && git remote set-url origin https://github.com/$GITHUB_USER/$REPO_NAME.git && git push --mirror

Keybase proof

I hereby claim:

  • I am castaneai on github.
  • I am castaneai (https://keybase.io/castaneai) on keybase.
  • I have a public key ASB0UigtWHu8Gzb_dS1eE-uLPeKvrsRfuDpDea9x7MHGbAo

To claim this, I am signing this object:

@castaneai
castaneai / App.tsx
Created November 20, 2018 06:23
react list start
import React, { Component } from 'react';
import './App.css';
import ItemList from "./ItemList";
import Item from "./Item";
interface Props {
}
interface State {
items: Item[]
}
@castaneai
castaneai / main.go
Created November 1, 2018 05:14
gae/go + spanner + opencensus
package main
import (
"cloud.google.com/go/spanner"
"context"
"contrib.go.opencensus.io/exporter/stackdriver"
"fmt"
"go.opencensus.io/plugin/ochttp"
"go.opencensus.io/trace"
"log"
<public:attach event="onload" for="window" onevent="initialise()" />
<script language="javascript">
function initialise() {
document.write("goooooooooooooooooooooooooold");
}
</script>
@castaneai
castaneai / tee.go
Created October 25, 2018 10:04
io.TeeReader example
package main
import (
"os"
"io"
"log"
)
func main() {
filename := os.Args[1]
@castaneai
castaneai / app.jsx
Created February 27, 2015 10:27
React.js (ES6) Simple Counter
class App extends React.Component {
constructor(props) {
this.state = {
count: 0
}
}
onClick(e) {
this.setState({
count: this.state.count + 1