Skip to content

Instantly share code, notes, and snippets.

View alimogh's full-sized avatar

alimogh

View GitHub Profile
@alimogh
alimogh / colors.py
Created May 9, 2024 10:20 — forked from rene-d/colors.py
ANSI color codes in Python
# SGR color constants
# rene-d 2018
class Colors:
""" ANSI color codes """
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
@alimogh
alimogh / relativeStrengthIndex.py
Created May 2, 2024 21:49 — forked from whittlem/relativeStrengthIndex.py
Trading using Python — Relative Strength Index (RSI)
# data: dictionary { 'dd/mm/yyy': price, 'dd/mm/yyyy': price, ... }
def relativeStrengthIndex(data, num):
if not isinstance(data, dict):
raise Exception('Dictionary input expected')
if not isinstance(num, int):
raise Exception('Integer input expected')
@alimogh
alimogh / Activity_main.xml
Created February 14, 2023 00:27 — forked from TasnuvaOshin/Activity_main.xml
Android JSON data parsing showing into ListView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.oshin.myjsonlist.MainActivity">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
from os import close
import sys
import getopt
def add(name, quantity, price):
with open('data', 'a') as f:
f.write(f"{name}-{quantity}-{price}\n")
private void init()
{
WebView webview = (WebView) findViewById(R.id.webview);
WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
PdfWebViewClient pdfWebViewClient = new PdfWebViewClient(this, webview);
pdfWebViewClient.loadPdfUrl(
"https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwjgwIfp3KXSAhXrhFQKHQqEDHYQFggZMAA&url=http%3A%2F%2Fwww.orimi.com%2Fpdf-test.pdf&usg=AFQjCNERYYcSfMLS5ukBcT2Qy11YxEhXqw&cad=rja");
@alimogh
alimogh / Main.java
Created May 10, 2021 05:59 — forked from andre77/Main.java
Example last trade
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import bittrex.BittrexWS;
import bittrex.CurrencyPair;
import bittrex.Trade;
@alimogh
alimogh / Main.java
Created May 10, 2021 05:59 — forked from andre77/Main.java
Example last trade
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import bittrex.BittrexWS;
import bittrex.CurrencyPair;
import bittrex.Trade;
/*
* BottomNavigationLayout library for Android
* Copyright (c) 2016. Nikola Despotoski (http://github.com/NikolaDespotoski).
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@alimogh
alimogh / Toolbar.java
Created May 10, 2021 05:37 — forked from gabrielemariotti/Toolbar.java
Android-L: A little example of the new Toolbar view.
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
//Title and subtitle
toolbar.setTitle("MY toolbar");
toolbar.setSubtitle("Subtitle");
//Menu
toolbar.inflateMenu(R.menu.toolbar_menu);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@alimogh
alimogh / MainActivity.java
Created May 10, 2021 05:30 — forked from ManuelPeinado/MainActivity.java
Fading action bar effect using the new Toolbar class from the support library
package com.github.manuelpeinado.toolbartest;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.View;