Skip to content

Instantly share code, notes, and snippets.

Tejas Dinkar gja

Block or report user

Report or block gja

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
@gja
gja / get-google-font.sh
Created Oct 24, 2018
Get fonts from Google Font in woff2 and woff
View get-google-font.sh
#!/bin/bash -e
function getCSSFile() {
curl -sH "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0" "https://fonts.googleapis.com/css?family=$@"
echo ---------------------
curl -sH "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36" "https://fonts.googleapis.com/css?family=$@"
}
function mergeCSSfiles() {
gawk -f <(cat << EOF
@gja
gja / paste-in-console.js
Created Jan 18, 2018
Print out the Barbie
View paste-in-console.js
deleteElement = (elem) => elem.parentElement.removeChild(elem)
deleteElement($(".show_print")[0]);
deleteElement($(".app-band-text")[0]);
deleteElement($(".nudge-app-band-wrapper")[0]);
$(".article-content").addClass("show_print");
window.print();
@gja
gja / infinite-scroll.js
Last active Nov 22, 2017
React Infinite Scroll with IntersectionObserver
View infinite-scroll.js
const React = require("react");
// An item in the infinite scroll
class ScrollItem extends React.Component {
constructor(props) {
super(props);
this.state = {
minHeight: props.minHeight
}
}
@gja
gja / Readme.md
Last active Nov 11, 2017
Cat Mode on OSX
View Readme.md
  1. Install Karabiner-Elements https://pqrs.org/osx/karabiner/
  2. Save this as your ~/.config/karabiner/karabiner.json
  3. Launch Karabiner-Elements
  4. You will have a profile called Cat Mode which disables all keys except the power button

There is a github repo which was a Karabiner extension I borrowed some inspiration from. I'll link to it if I find it again.

@gja
gja / volume.clj
Created Apr 28, 2017
Find the shortest path to a certain volume
View volume.clj
(defn- neighboring-edges [node capacity]
(for [i (range (count capacity))
j (range (count capacity))
:when (not= i j)]
(let [total-amount (+ (get node i) (get node j))
amount-in-j (min total-amount (get capacity j))
amount-in-i (- total-amount amount-in-j)]
{:node (assoc node i amount-in-i j amount-in-j)
:pour [i j]})))
@gja
gja / main.go
Last active Dec 15, 2016
Program Showing Of Go Pipelining
View main.go
package main
import (
"fmt"
"time"
"sync"
)
func producer(output_channel chan <- int) {
for i := 0; i < 100; i++ {
@gja
gja / log4j2.xml
Last active Sep 25, 2015
log4j2 and ryslog2
View log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Syslog name="syslog" host="localhost" port="4242" protocol="UDP" format="RFC5424" enterpriseNumber="18060" appName="quest" mdcId="quest">
<LoggerFields>
<KeyValuePair key="thread" value="%t"/>
<KeyValuePair key="name" value="%c"/>
</LoggerFields>
</Syslog>
<Async name="AsyncUDPAppender">
@gja
gja / core.clj
Last active Dec 16, 2017
Building a lein uberjar without any compilation
View core.clj
(ns simplequest.core)
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!"))
@gja
gja / combine-pdf.sh
Created Jun 28, 2014
Command to combine PDFs
View combine-pdf.sh
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py --output output.pdf $@
@gja
gja / plot-yourkit-heap.gnuplot
Created Jun 26, 2014
Plot a Yourkit Memory Heap CSV
View plot-yourkit-heap.gnuplot
#! /usr/bin/env gnuplot
set terminal png size 1024,768 font "/Library/Fonts/Arial.ttf" 12
set output "output.png"
set style line 1 lt 1 lw 2 pt 7 pi -1 ps 1.5
set pointintervalbox 3
set datafile separator ','
You can’t perform that action at this time.