Skip to content

Instantly share code, notes, and snippets.

View nishanthvijayan's full-sized avatar

Nishanth Vijayan nishanthvijayan

View GitHub Profile
@matthewhegarty
matthewhegarty / django-import-export-bulk-import.md
Last active July 28, 2023 20:49
Performance improvements for `django-import-export` bulk import

Performance improvements for bulk import

I implemented for my own use case - not fully tested - use at your own risk

This is how I improved performance of django-import-export when importing a large set of new rows.

  • Thinkpad T470 i5 processor (Ubuntu 18.04)
  • 20,000 new rows to be inserted
  • total import duration 5.4 seconds
@hakib
hakib / admin.py
Last active January 22, 2024 15:18
How to Turn Django Admin Into a Lightweight Dashboard
# https://hakibenita.com/how-to-turn-django-admin-into-a-lightweight-dashboard
from django.contrib import admin
from django.db.models import Count, Sum, Min, Max, DateTimeField
from django.db.models.functions import Trunc
from . import models
def get_next_in_date_hierarchy(request, date_hierarchy):
@SpringBootApplication
class Application
fun main(args: Array<String>) {
SpringApplication.run(Application::class.java, *args)
}
data class Greeting(val id: Long, val content: String)
@RestController
@manjula-dube
manjula-dube / ReactiveConf-CFP.md
Last active January 5, 2024 20:17
CFP: Reactive Conf: Jest & Enzyme complement each other.
This is a proposal for ReactiveConf 2017 open call for Lightning talks. If you'd like to make this talk happen, please 🌟 this gist and retweet my tweet. 🙏

If you're on your phone, please request the 🖥 desktop site to star this gist 😇

I would talk about some myths on Jest & Enzyme. Moreover to stop the comparison of Jest and Enzyme. Instead would focus on how they can work together to test well your React Components. The talk would focus on "How Jest and Enzyme complement each other" and can help you test React components in a better way.

  1. If you are writing tests: you are already winning.
  2. If you are not writing tests:let me encourage you to start.
  3. Jest.
  4. Snapshot Testing.
@svcavallar
svcavallar / rabbitmq_reconnect.go
Created September 20, 2016 22:23
Golang example to reconnect to RabbitMQ on a connection closed event
package main
import (
"flag"
"github.com/streadway/amqp"
"log"
"time"
)
var amqpUri = flag.String("r", "amqp://guest:guest@127.0.0.1/", "RabbitMQ URI")
@ankurk91
ankurk91 / bash_profile.md
Last active October 22, 2023 12:16
:octocat: Git branch name in Linux/Mac Bash Terminal

Mac OS : Show your git branch name on your bash terminal

⚠️ Does not work in zsh terminal

Add these lines in your ~/.bash_profile file

# Show current git branch name
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@vasanthk
vasanthk / System Design.md
Last active May 6, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@mogsdad
mogsdad / Apps Script pdfToText utility.md
Last active April 10, 2024 01:38
For http://stackoverflow.com/questions/26613809, a question about getting pdf attachments in gmail as text. I got a little carried away - this does much more than asked.

Google Apps Script pdfToText Utility#

This is a helper function that will convert a given PDF file blob into text, as well as offering options to save the original PDF, intermediate Google Doc, and/or final plain text files. Additionally, the language used for Optical Character Recognition (OCR) may be specified, defaulting to 'en' (English).

Note: Updated 12 May 2015 due to deprecation of DocsList. Thanks to Bruce McPherson for the getDriveFolderFromPath() utility.

    // Start with a Blob object
    var blob = gmailAttchment.getAs(MimeType.PDF);