Skip to content

Instantly share code, notes, and snippets.

View timothy's full-sized avatar
🎯
Focusing

Timothy timothy

🎯
Focusing
View GitHub Profile
@samhorne
samhorne / BackgroundCheck.kt
Created July 19, 2022 15:43
Android check if app in foreground or background
fun printProcessInfo(){
val myProcess = RunningAppProcessInfo()
ActivityManager.getMyMemoryState(myProcess)
val isInBackground = myProcess.importance != RunningAppProcessInfo.IMPORTANCE_FOREGROUND
Log.i("activitystate", "isInBackground: $isInBackground")
Log.i("activitystate", "Process: ${myProcess.importance}")
}
@quantra-go-algo
quantra-go-algo / Commodity Channel Index.py
Created December 25, 2021 11:59
Build Technical Indicators In Python - CCI
# Commodity Channel Index Python Code
# Load the necessary libraries
from pandas_datareader import data as pdr
import matplotlib.pyplot as plt
import yfinance
import pandas as pd
# Commodity Channel Index
def CCI(df, ndays):
df['TP'] = (data['High'] + data['Low'] + data['Close']) / 3
@nhtua
nhtua / 00.install-android-sdk.sh
Last active July 18, 2024 10:50
Run a Headless Android Device on Ubuntu server (no GUI)
#!/bin/bash -i
#using shebang with -i to enable interactive mode (auto load .bashrc)
set -e #stop immediately if any error happens
# Install Open SDK
apt update
apt install openjdk-8-jdk -y
update-java-alternatives --set java-1.8.0-openjdk-amd64
java -version
@davidbgk
davidbgk / server.py
Created April 11, 2017 15:39
An attempt to create the simplest HTTP Hello world in Python3
import http.server
import socketserver
from http import HTTPStatus
class Handler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(HTTPStatus.OK)
self.end_headers()
self.wfile.write(b'Hello world')
@elevenetc
elevenetc / gist:bf795f94aaf3e92169ef
Last active March 23, 2024 17:00
Android SuppressWarnings list
//src: http://kurrytran.blogspot.ru/2014/05/android-studio-list-of-suppress-warning.html
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/adt-branding/src/META-INF/AndroidIdePlugin.xml
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/android/src/META-INF/plugin.xml
//Most Common Annotations
@SuppressWarnings("all")
@SuppressWarnings("unchecked")
@SuppressWarnings({"JavaDoc"})
@SuppressWarnings({"UnusedDeclaration"})
@jrmoran
jrmoran / public-app.js
Created December 13, 2012 15:12
AngularJS and Express, rendering ejs-locals partials
var app = angular.module('app', ['ngResource']);
app.config(function($locationProvider, $routeProvider) {
// $locationProvider.html5Mode(true);
$routeProvider
.when('/', { templateUrl: 'partials/index', controller: 'ctrl' })
.when('/about', { templateUrl: 'partials/about', controller: 'ctrl' })
.otherwise({redirectTo:'/'});
});