Skip to content

Instantly share code, notes, and snippets.

@disq
disq / trtspor.js
Last active October 12, 2017 11:28
TRTspor canli yayin ekrani fix
// http://www.trtspor.com.tr/canli-yayin-izle/trt-spor-159/
$(".video-single .video-source").css("width", "1280px");$("#wrapper .top-navigation,.all_wrapper .header, .bar, .content, .footer").add($(".video-source > div")[1]).remove();$("body,.all_wrapper,.video-detail").css("background","#000000");
package main
import (
"fmt"
"database/sql"
"time"
_ "github.com/VoltDB/voltdb-client-go/voltdbclient"
)
@disq
disq / examplepool.go
Created January 24, 2017 11:48
example for issue 18081
package examplepool
import (
"context"
"errors"
"fmt"
"sync"
"time"
_ "github.com/alexbrainman/odbc"
@disq
disq / gcd.sh
Last active January 2, 2017 07:46
gcd: cd in GOPATH
# Put this in ~/.bash_profile
# https://gist.github.com/disq/42459b522836b25f30469b3acb5500bf
gcd() {
if [[ "$1" == "" || "$2" != "" ]]; then
echo "Usage: gcd <dir in gopath>"
return 1
fi
FINDIN=${GOPATH}/src
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"strings"
@disq
disq / scan.go
Last active November 15, 2016 09:41
import (
"bufio"
"context"
"io"
)
type CancelableScanner struct {
*bufio.Scanner
data chan string
err chan error
@disq
disq / go.mk
Created November 11, 2016 14:33
Makefile defaults file for generic Go projects (golang)
#
# Generic Go project makefile defaults file
#
# Usage:
#
# Renaming this file to "Makefile" and running "make" should just work.
# But you can also override one or more recipes:
#
# - Include this file with "include go.mk" as the first line of your custom Makefile
# - Define recipes using SRCDIR, GOROOT, GCFLAGS, LDFLAGS
@disq
disq / Makefile
Last active January 10, 2022 20:00
Makefile for golang
#
# Generic Go project makefile
#
# Example:
# make PREFIX= DESTDIR=/tmp/project-name-build install
#
# PREFIX is mostly unused, it would be used to expose the installation path to installed files
# For now, running "make install" with PREFIX= is OK (as long as DESTDIR is set)
#
# For capistrano, it would be something like this:
#!/usr/bin/awk -f
function init() {
# allow max 50 fields
for(i=0;i<50;i++) {
last_data[i][""] = "";
split("", last_data[i]); # make it an array
}
}
function dump() {
@disq
disq / trans-check.sh
Created June 12, 2011 09:11
Script to send e-mail on new transactions in bitcoin
#!/bin/bash
RET=`/usr/local/bin/bitcoind --rpcconnect listtransactions`
RETCNT=`echo ${RET}|php -r '$x = file_get_contents("php://stdin");$a=json_decode($x);echo count($a);'`
LASTCNT=`cat ~/gen-check.last 2>/dev/null`
if [ "$LASTCNT" == "" ]; then
LASTCNT=0
fi
if [ $RETCNT -gt $LASTCNT ]; then
echo "sound the alarm, we have transactions"
echo "`date` ${RET}" | sendemail -q -f from@gmail.com -t to@gmail.com -u "BITCOIN TRANSACTIONS!" -s smtp.gmail.com:587 -o tls=auto -xu from@gmail.com -xp password-of-from-gmail