Skip to content

Instantly share code, notes, and snippets.

View Idnan's full-sized avatar

Adnan Ahmed Idnan

View GitHub Profile
@Idnan
Idnan / check_my_followers_stats.js
Created August 29, 2021 16:52 — forked from zwithz/check_my_followers_stats.js
A widget to visually show all my social media's followers stats by @scriptable. For more details -> https://twitter.com/zwithz1998/status/1296834411300716544
// Use @substats, a open source repo on @Github, to fetch all my social medias' stats
const url = "https://api.spencerwoo.com/substats/?source=weibo&queryKey=2028434647&source=twitter&queryKey=zwithz1998&source=jikeFollower&queryKey=e1377acb-40ed-495e-9a73-158273b4090a"
const req = new Request(url)
const json = await req.loadJSON()
const data = json.data.subsInEachSource
// Twitter
const twitterFollowers = data.twitter
---
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
@Idnan
Idnan / products.txt
Created June 13, 2020 10:07
Build Facets With Elasticsearch
{ "index" : { "_index" : "products" } }
{"name": "MacBook Pro Touch Bar Laptop With 13.3-Inch Retina Display, Core i5 with 1.4GHz Quad Core Processor/8GB RAM/128GB SSD/Intel Iris Plus Graphics 645/English Keyboard 2019 Space Gray", "attributes": {"brand": "Apple", "processorType": "Core i5"} }
{ "index" : { "_index" : "products" } }
{"name": "MacBook Air With 13.3-Inch Retina Display, Core i3 Processor/8GB RAM/256GB SSD/Intel Iris Plus Graphics With English Keyboard 2020 Space Gray", "attributes": {"brand": "Apple", "processorType": "Core i3"} }
{ "index" : { "_index" : "products" } }
{"name": "MacBook Air 13.3-Inch, Core i5 with 1.8GHz Dual Core Processor/8GBRAM/128GB SSD/Intel HD Graphics 6000 - 2017 Silver", "attributes": {"brand": "Apple", "processorType": "Core i5"} }
{ "index" : { "_index" : "products" } }
{"name": "Macbook Pro With Touch Bar And Touch ID, 13.3-Inch Display, Core i5, 8th Generation,1.4 Ghz Quad Core Processor/8GB RAM/256GB SSD/Intel Iris Plus Graphics 645/Retina Display, English Keybo
@Idnan
Idnan / pull-latest.sh
Created May 8, 2020 15:56
Script to update all your git repos with remote
pull-latest() {
for dir in $(find . -name ".git")
do cd ${dir%/*}
echo $PWD
git reset --hard HEAD
git checkout develop
git pull origin develop
if [ -f "./package.json" ]; then
yarn install
fi
@Idnan
Idnan / get_latest_release.sh
Created January 6, 2020 06:52 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
To use in react-native, choose from font below, and then add to style element:
<Text style={{ fontFamily: 'Arial' }}>Arial Font</Text>
Alternatively, add your own custom font face
Android:
========
normal
@Idnan
Idnan / simple-pagination.js
Created November 21, 2019 21:29 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m) {
var current = c,
last = m,
delta = 2,
left = current - delta,
right = current + delta + 1,
range = [],
rangeWithDots = [],
l;
import 'dotenv/config';
import * as grpc from 'grpc';
import { protoIndex } from './proto';
import greeterHandler from './handlers/greeter';
protoIndex();
const port: string | number = process.env.PORT || 50051;
import * as grpc from 'grpc';
import { HelloRequest, HelloResponse } from './proto/greeter/greeter_pb';
import { GreeterService, IGreeterServer } from './proto/greeter/greeter_grpc_pb';
class GreeterHandler implements IGreeterServer {
/**
* Greet the user nicely
* @param call
* @param callback
@Idnan
Idnan / index.ts
Created November 2, 2019 09:02
src/proto/index.ts
import './greeter/greeter_pb';
import './greeter/greeter_grpc_pb';
export const protoIndex:any = ():void => {
};