Skip to content

Instantly share code, notes, and snippets.

View adhadse's full-sized avatar
🐧

Anurag Dhadse adhadse

🐧
View GitHub Profile
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"regexp"
)
@adhadse
adhadse / book.rs
Last active October 7, 2022 01:33
use once_cell::sync::Lazy;
use std::collections::{HashMap, HashSet};
use anyhow::Result;
use gtk::glib::{
self, clone, Enum, ObjectExt, ParamFlags, ParamSpec, ParamSpecEnum, ParamSpecObject, Sender, ToValue,
};
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use std::cell::Cell;
use std::collections::hash_map::Values;
@adhadse
adhadse / .bashrc
Last active July 13, 2022 12:40
A custom prompt for bash that sets python virtual environment, conda venv and git branch name on prompt (with colorful text)
# Custom Prompt
# The various escape codes that we can use to color our prompt.
RED="\[\033[0;31m\]"
YELLOW="\[\033[1;33m\]"
GREEN="\[\033[0;32m\]"
USERNAME="\[\033[0;35m\]"
DIRCOLOR="\[\033[0;38;5;50m\]"
BLUE="\[\033[1;096m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
#!/bin/bash -e
base_dir=$(dirname $(dirname $0))
target_dir="${base_dir}/examples/ ${base_dir}/keras_nlp/"
targets="${base_dir}/*.py ${base_dir}/examples/ ${base_dir}/keras_nlp/"
isort --sp "${base_dir}/setup.cfg" --sl ${targets}
black --line-length 80 ${targets}
for i in $(find ${target_dir} -name '*.py'); do
#!/bin/bash -e
base_dir=$(dirname $(dirname $0))
target_dir="${base_dir}/examples/ ${base_dir}/keras_nlp/"
targets="${base_dir}/*.py ${base_dir}/examples/ ${base_dir}/keras_nlp/"
isort --sp "${base_dir}/setup.cfg" --sl ${targets}
black --line-length 80 ${targets}
for i in $(find ${target_dir} -name '*.py'); do
@adhadse
adhadse / tensorboard_on_kaggle.py
Last active September 28, 2021 13:22
Script to run TensorBoard on Kaggle. Enable internet for the kernel.
import os
import multiprocessing
# Clear any logs from previous runs
!rm -rf ./logs/
!mkdir ./logs/
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip ngrok-stable-linux-amd64.zip
pool = multiprocessing.Pool(processes = 10)
PREFIX : <urn:example:>
SELECT ?personName where {
?person :name ?personName.
?person :livesIn / :within* / :name "Gujrat".
?person :worksIn / :within* / :name "Tiger Softwares".
}
@prefix : <urn:example:>
_:india a :Location; :name "India"; type: "country".
_:gujrat a :Location; :name "Gujrat"; type: "state"; :within _:india.
_:indore a :Location; :name "Indore"; type: "city"; :within _:gujrat.
_:ts a :Company; :name "Tiger Softwares"; :profession "Application Developer".
_:rahul a :Person; :name "Rahul"; :worksIn _:ts.
MATCH
(person) -[:WORKS_IN]-> (TS:Company {name: 'Tiger Softwares'}),
(person) -[:LIVES_IN]-> () -> [:WITHIN*0..]-> (Gujrat:Location {name:'Gujrat'})
RETURN person.name
CREATE
(India:Location {name: 'India', type: 'country'}),
(Gujrat:Location {name: 'Gujrat', type: 'state'}),
(Indore:Location {name: 'Indore', type: 'city'}),
(Rahul:Person {name: 'Rahul'}),
(TS:Company {name: 'Tiger Softwares', profession: 'Application Developer'}
(Rahul) -[:WITHIN]-> (Indore) -[:WITHIN]-> (Gujrat) -[:WITHIN]-> (India)
(Rahul) -[:WORKS_IN]-> (TS)