Skip to content

Instantly share code, notes, and snippets.

View tirkarthi's full-sized avatar

Karthikeyan Singaravelan tirkarthi

View GitHub Profile
@tirkarthi
tirkarthi / gist:e28f62eb562db5037634
Last active August 29, 2015 14:17
Perl script for World cup
#!/usr/bin/perl
use strict;
use warnings;
while (1) {
`wget --no-proxy --quiet http://static.cricinfo.com/rss/livescores.xml -O score.txt`;
sleep(10); # Set to seconds
my $text = `cat score.txt`;
$text =~ m!<title>(.*India.*)</title>!;
@tirkarthi
tirkarthi / gist:1a37fb7046ba6d7e4f2c
Created May 27, 2015 13:04
Fast parallel downloads using HTTP Accept-Ranges and Go-routines
package main
import (
"io/ioutil"
"net/http"
"strconv"
"sync"
)
var wg sync.WaitGroup
@tirkarthi
tirkarthi / .el
Created October 1, 2015 12:27
My emacs config
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-names-vector ["#272822" "#F92672" "#A6E22E" "#E6DB74" "#66D9EF" "#FD5FF0" "#A1EFE4" "#F8F8F2"])
'(compilation-message-face (quote default))
'(css-indent-offset 2)
'(cua-prefix-override-inhibit-delay 1)
'(custom-safe-themes (quote ("a041a61c0387c57bb65150f002862ebcfe41135a3e3425268de24200b82d6ec9" "460dc689943a7603b34590b732b3f8ccc398eddb7da49bceb4f983a86db0df8f" "09fa83e024b8fd8e03a43c167b0b542424a917c260fee1883e8d3268fad47a89" "a772eafba4eda0ed57a5d651a96804487a1dacbfbf8658084bfe84546a7c7008" default)))
@tirkarthi
tirkarthi / .emacs
Last active September 27, 2019 04:31
Emacs config
;; Add modes and deactivate modes
(menu-bar-mode -1)
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
@tirkarthi
tirkarthi / postgres_text_search.sql
Last active October 6, 2017 06:16
Postgres text search
example=# CREATE DATABASE test;
CREATE DATABASE
example=# \c test
test=# create table example(name varchar(100), description varchar(100));
CREATE TABLE
test=# insert into example values('test', 'test');
INSERT 0 1
test=# insert into example(name) values('test 12');
INSERT 0 1
test=# insert into example(name) values('test 13');
#!/usr/bin/env bash
# Install zsh and oh my zsh
sudo apt-get install zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
# Install emacs
sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt-get update
(ns foo.coloring-tn
(:require [clojure.core.logic :refer :all]
[clojure.core.logic.pldb :as pldb]))
(def facts
(pldb/db
[color 'red]
[color 'green]
[color 'blue]
@tirkarthi
tirkarthi / bench.clj
Created October 27, 2017 06:12 — forked from hiredman/bench.clj
core.logic for joinery
#!/usr/bin/java -jar clojure-1.7.0-master-SNAPSHOT.jar
(let [pom-uber-jar
(str "http://thelibraryofcongress.s3.amazonaws.com/"
"pomegranate-0.0.13-SNAPSHOT-jar-with-dependencies.jar")
cl (java.net.URLClassLoader. (into-array [(java.net.URL. pom-uber-jar)]))
cx (.getContextClassLoader (Thread/currentThread))]
(push-thread-bindings {clojure.lang.Compiler/LOADER cl})
@tirkarthi
tirkarthi / filter_spec.clj
Created November 1, 2017 07:16 — forked from bhb/filter_spec.clj
Adding your own spec for filter
(require '[clojure.spec.test.alpha :as st])
(require '[clojure.spec.alpha :as s])
(require '[expound.alpha :as expound])
(set! s/*explain-out* expound/printer)
(st/instrument)
(filter 123 "12333333333333") ; java.lang.Long cannot be cast to clojure.lang.IFn
(s/fdef clojure.core/filter

Keybase proof

I hereby claim:

  • I am tirkarthi on github.
  • I am xtreak (https://keybase.io/xtreak) on keybase.
  • I have a public key whose fingerprint is 3B8A C6F5 70B4 542F D4D9 8AF9 4667 3968 FCF5 AA9C

To claim this, I am signing this object: