Skip to content

Instantly share code, notes, and snippets.

@fumin
fumin / present.go
Created July 5, 2014 04:09
Example of using the present package
package main
import (
"bytes"
"html/template"
"net/http"
"code.google.com/p/go.tools/present"
)
@fumin
fumin / concat.go
Last active August 29, 2015 14:05
A command to truncate and then concatenate Google Cloud Storage files
package main
import (
"bytes"
"flag"
"fmt"
"os"
"os/exec"
"strings"
)
@fumin
fumin / background.sh
Created November 22, 2015 19:59
script to restart all background processes including dynamodb, sqs, redis, and elasticsearch
#!/bin/sh
function killport {
while true; do
PID=$(lsof -i TCP:$1 | grep LISTEN | awk '{print $2}')
exec 3>&2 # 3 is now a copy of 2
exec 2> /dev/null # 2 now points to /dev/null
kill $PID
kill -0 $PID
@fumin
fumin / dynamodb_invalid_utf8.go
Created April 14, 2017 18:48
Demonstration that DynamoDB automatically collates String fields, which is undesirable.
package main
import (
"flag"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/pkg/errors"
@fumin
fumin / mat_pretty_printer.py
Created April 10, 2022 13:58
pretty printer for opencv Mat
numpy_code = """
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Almar Klein and Wade Brainerd
# tinynumpy is distributed under the terms of the MIT License.
#
# Original code by Wade Brainerd (https://github.com/wadetb/tinyndarray)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@fumin
fumin / bashrc
Last active February 26, 2025 11:43
bashrc
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
export PATH=/usr/local/ffmpeg-6.1-amd64-static:$PATH
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
open() {
nautilus $1 &
}