Skip to content

Instantly share code, notes, and snippets.

View ruan65's full-sized avatar
🎯
Focusing

Andrew ruan65

🎯
Focusing
View GitHub Profile
@ruan65
ruan65 / .bash_profile
Last active February 21, 2020 22:38
my mac bash profile
export PS1='$ '
export PS1='$ '
export PS1='\W $ '
export EDITOR=nano
export VISUAL='$EDITOR'
export PATH=$PATH:~/Library/Android/sdk/platform-tools:~/soft/flutter/bin/cache/dart-sdk/bin:~/soft/flutter/bin:/usr/local/opt/openssl/bin
alias hs='history'
alias ll='ls -lah'
alias ga='git add .'
@ruan65
ruan65 / user.xml
Last active March 1, 2019 14:10
Android Studio Live Templates code snippets /home/a/.AndroidStudio3.3/config/templates/user.xml on Ubuntu /Users/a/Library/Preferences/AndroidStudio3.3/templates/user.xml on Mac
<templateSet group="user">
<template name="imf" value="import 'package:flutter/material.dart';" description="Import flutter material" toReformat="false" toShortenFQNames="true">
<context>
<option name="DART" value="true" />
</context>
</template>
<template name="fblo" value="import 'dart:async';&#10;import 'package:bloc/bloc.dart';&#10;&#10;class $name$Bloc extends Bloc&lt;$event$, $state$&gt; {&#10;&#10;&#10; @override&#10; $name$State get initialState =&gt; null;&#10;&#10; @override&#10; Stream&lt;$name$State&gt; mapEventToState($state$ currentState, $event$ event) {&#10; $cursor$&#10; return null;&#10; }&#10;&#10;}" description="flutter bloc class template" toReformat="false" toShortenFQNames="true">
<variable name="name" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="event" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="state" expression="" defaultValue="" alwaysStopAt="true" />
ta test async
test(
'should $ACT$ when $END$',
() async {
// arrange
// act
// assert
@ruan65
ruan65 / maxidaemon.sh
Created January 31, 2019 11:00
service file maxidemon in /etc/init.d & maxidaemon.sh in /opt
#!/bin/bash
cd /home/dev/maxidroid/
su -c '(
until java -Xms512m -Xmx1024m -jar maxidroid_asio*.jar --jar.name=`ls | grep maxidroid_asio` --app.started=`date "+%d.%m.%Y_at_%H:%M:%S"` ; do
echo "Application crashed with exit code $?. Respawning... " >&2
sleep 5
done
/*
* Licensed Materials - Property of IBM
*
* (C) COPYRIGHT IBM CORP. 2015 All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
*/
package premiumapp.org.jtimer.dialogs;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.Window;
@ruan65
ruan65 / TmdbApi.kt
Created September 22, 2018 17:55 — forked from rubenpla-develop/TmdbApi.kt
#Kotlin #Android Retrofit2 singleton instance sample
package rubenpla.develop.privtmdbendlesslist.data.api
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET
import retrofit2.http.Query
import rubenpla.develop.privtmdbendlesslist.data.model.MoviesResultsItem
interface TmdbApi {
package ru.redsys.rea_conference.network;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v4.app.JobIntentService;
import android.util.Log;
import org.greenrobot.eventbus.EventBus;
@ruan65
ruan65 / WebConfig.java
Created February 8, 2018 09:35
Controller method CORS configuration
// if localhost do not forget add http:// before url
package ru.redsys.event_manager_rea.configuration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@ruan65
ruan65 / bash.java
Created January 19, 2018 11:27
run bash via java
public static void main(String[] args) {
String[] cmd = new String[]{"/bin/sh", "/home/a/temp/notify.sh"};
try {
Process pr = Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
e.printStackTrace();
}
}