Skip to content

Instantly share code, notes, and snippets.

@dat-vikash
dat-vikash / geoipexample.scala
Created October 9, 2015 15:45
geoip sink example
trait EventStoreServiceWithLogstashSink extends EventStoreService
{
this: EventStore =>
// set config
val config = EventStoreCollectorConfig(logstashEndpoint = Some(Application.CONFIGS.get("logstash-endpoint").get.convertTo[String]))
case class MyCustomEvent(fact: Any,
timestamp: Option[Long] = None,
apiVersion: Option[String] = None,
originHost: Option[String]= None,
@dat-vikash
dat-vikash / latency.txt
Created October 24, 2016 23:32 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
      ### Keybase proof

I hereby claim:

  • I am dat-vikash on github.
  • I am datvikash (https://keybase.io/datvikash) on keybase.
  • I have a public key ASA0rfvSJCHjPeXlJSJlZ-cTwiIiO_joi5SnMZW-O1fU7go

To claim this, I am signing this object:

@dat-vikash
dat-vikash / faster_toPandas.py
Created February 27, 2018 12:52 — forked from joshlk/faster_toPandas.py
PySpark faster toPandas using mapPartitions
import pandas as pd
def _map_to_pandas(rdds):
""" Needs to be here due to pickling issues """
return [pd.DataFrame(list(rdds))]
def toPandas(df, n_partitions=None):
"""
Returns the contents of `df` as a local `pandas.DataFrame` in a speedy fashion. The DataFrame is
repartitioned if `n_partitions` is passed.
@dat-vikash
dat-vikash / asciiputsonglasses
Created May 3, 2018 15:14 — forked from staringispolite/asciiputsonglasses
Ascii art sunglasses meme
Puts on glasses:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
Takes off glasses ("mother of god..."):
(⌐■_■)
( •_•)>⌐■-■
@dat-vikash
dat-vikash / postgres_queries_and_commands.sql
Created September 3, 2020 19:37 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@dat-vikash
dat-vikash / caddie_bot.py
Last active March 4, 2025 10:37
script to help golf hacker
"""
Helps make dad life easier by reserving times before pre-k.
Features:
- allow for filtering by time, day of week, number of player and course
- handles reservations and ensures no overbooking
- keeps track of default and state
Requires python3 and selenium:
+ https://sites.google.com/chromium.org/driver/