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

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: trailing-whitespace
exclude: (\.css$|\.html$)
- id: check-merge-conflict
- id: debug-statements
- id: flake8
args: [--max-line-length=131, --ignore=W503]
exclude: (.*/migrations/.*|.*/data/.*|.*/settings/.*)$
@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
running 2429 tests
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
..........................................................................i.........................
...................................ii..iii..........................................................
...................................................................i................................
.............i......................................................................................
error: internal compiler error: librustc_mir/transform/elaborate_drops.rs:375: drop of untracked, uninitialized value bb8, place ((*_3).0: core::option::Option<T>) (Parent(Some(mp3)))
--> libstd/sync/mpsc/spsc_queue.rs:139:13
|
139 | (*n).value = Some(t);
| ^^^^^^^^^^
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:499:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs
index 85458c7..eb5aace 100644
--- a/src/librustc_mir/dataflow/mod.rs
+++ b/src/librustc_mir/dataflow/mod.rs
@@ -11,7 +11,7 @@
use syntax::ast::{self, MetaItem};
use rustc_data_structures::indexed_set::{IdxSet, IdxSetBuf};
-use rustc_data_structures::indexed_vec::Idx;
+use rustc_data_structures::indexed_vec::{Idx, IndexVec};

Keybase proof

I hereby claim:

  • I am pramodbisht on github.
  • I am pramodpsb (https://keybase.io/pramodpsb) on keybase.
  • I have a public key ASD5gZRo0i9InavXARmtSkBexrdJMcD7xSABJaXJhaB9ywo

To claim this, I am signing this object:

@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