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')
@legendSabbir
legendSabbir / main.js
Created October 17, 2023 16:09
Path Autocomplete
import plugin from "../plugin.json";
const { editor } = editorManager;
const fsOperation = acode.require("fsOperation");
const helpers = acode.require("helpers");
const TokenIterator = ace.require("ace/token_iterator").TokenIterator;
const cache = Object.create(null);
const pathCompleter = {
id: "path-completion",
getCompletions: async function (editor, session, pos, prefix, callback) {
@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")
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")
import json, time
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
def main():
ws = None
thread = None
thread_running = False
thread_keepalive = None
@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() {