Skip to content

Instantly share code, notes, and snippets.

@javatrending
javatrending / index.html
Created February 16, 2021 03:39 — forked from darwin/index.html
Welcome to comix!
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">A Comix Sample</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
@javatrending
javatrending / basic.py
Created July 19, 2020 19:39 — forked from lorey/basic.py
Keeping Pandas DataFrames clean when importing JSON
from pandas.io.json import json_normalize
df = json_normalize(data)
@javatrending
javatrending / basic.py
Created July 19, 2020 19:39 — forked from lorey/basic.py
Keeping Pandas DataFrames clean when importing JSON
from pandas.io.json import json_normalize
df = json_normalize(data)
@javatrending
javatrending / gist:c103cc56efa8f14623f9b5ceb7a900b4
Created April 30, 2020 10:54 — forked from why-not/gist:4582705
Pandas recipe. I find pandas indexing counter intuitive, perhaps my intuitions were shaped by many years in the imperative world. I am collecting some recipes to do things quickly in pandas & to jog my memory.
"""making a dataframe"""
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
"""quick way to create an interesting data frame to try things out"""
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd'])
"""convert a dictionary into a DataFrame"""
"""make the keys into columns"""
df = pd.DataFrame(dic, index=[0])
@javatrending
javatrending / disp_multiple_images.py
Created April 14, 2020 01:37 — forked from soply/disp_multiple_images.py
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.
@javatrending
javatrending / KafkaStreamsConfig.java
Created August 26, 2019 01:56 — forked from itzg/KafkaStreamsConfig.java
Example of configuring Kafka Streams within a Spring Boot application with an example of SSL configuration
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsBuilder;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.Topology;
import org.apache.kafka.streams.kstream.GlobalKTable;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.Materialized;
@javatrending
javatrending / WhatsAppAutomationScript.js
Created March 12, 2019 10:51 — forked from techguybiswa/WhatsAppAutomationScript.js
What's App Automated "New Year Wish" Script
let listOfRecentContacts = document.getElementsByClassName("_3j7s9");
console.log("listOfRecentContacts.length = " + listOfRecentContacts.length);
var eventToSwitchMessageBox = new MouseEvent('mousedown', {
bubbles: true,
});
let count =1;
let openMessageBox = setInterval(function(){
// if(count>listOfRecentContacts.length) {
if(count>5) {
console.log("Clearing interval with clearInterval...");
@javatrending
javatrending / System Design.md
Created January 26, 2018 02:24 — forked from vasanthk/System Design.md
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?
@javatrending
javatrending / TileLayer.GeoJSON.js
Created November 9, 2016 18:22 — forked from glenrobertson/TileLayer.GeoJSON.js
Leaflet GeoJSON Tile Layer Example
// Load data tiles from an AJAX data source
L.TileLayer.Ajax = L.TileLayer.extend({
_requests: [],
_addTile: function (tilePoint) {
var tile = { datum: null, processed: false };
this._tiles[tilePoint.x + ':' + tilePoint.y] = tile;
this._loadTile(tile, tilePoint);
},
// XMLHttpRequest handler; closure over the XHR object, the layer, and the tile
_xhrHandler: function (req, layer, tile, tilePoint) {
@javatrending
javatrending / extensions.json
Created October 25, 2016 17:07 — forked from codefoster/extensions.json
Visual Studio code settings
[
{
"metadata": {
"galleryApiUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"id": "214cbfb9-7c06-4467-bad4-357ae83eb587",
"publisherId": "4434843a-4ebf-4f44-84f5-4176380c492d",
"publisherDisplayName": "johnpapa"
},
"name": "Angular2",
"publisher": "johnpapa",