Skip to content

Instantly share code, notes, and snippets.

View PramodBisht's full-sized avatar

Pramod Bisht PramodBisht

View GitHub Profile
@PramodBisht
PramodBisht / Read.md
Created February 29, 2024 12:42 — forked from Cobra16319/Read.md
Run Vagrant on an M1 Mac Book with Docker

Here is a sample multi-provider Vagrantfile that can use either VirtualBox or Docker as a provider with vagrant:

$touch Vagrantfile

#Copy and paste Vagrantfile into newly created file

@PramodBisht
PramodBisht / elasticsearch.md
Created May 23, 2019 18:31 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@PramodBisht
PramodBisht / celery.sh
Created January 7, 2019 13:30 — forked from amatellanes/celery.sh
Celery handy commands
/* Useful celery config.
app = Celery('tasks',
broker='redis://localhost:6379',
backend='redis://localhost:6379')
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
CELERY_QUEUES=(
Queue('default', routing_key='tasks.#'),
@PramodBisht
PramodBisht / latency.txt
Created July 16, 2018 09:39 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@PramodBisht
PramodBisht / BulkInsertManager.py
Created February 8, 2017 10:52 — forked from datamafia/BulkInsertManager.py
Django Bulk Insert Manager for ON DUPLICATE IGNORE and ON DUPLICATE KEY in MySQL
#!/usr/bin/env python
# marc-w.com
# Built and tested on Django 1.5
class BulkInsertManager(models.Manager):
def _bulk_insert_ignore(self, create_fields, values, print_sql=False):
'''
Bulk insert/ignore
@param create_fields : list, required, fields for the insert field declaration