Skip to content

Instantly share code, notes, and snippets.

Avatar

Mohammad Reza Eram mreram

  • Tehran
View GitHub Profile
View CViewPager.kt
package eram.ir.camerapager
import android.animation.ValueAnimator
import android.app.Activity
import android.content.Context
import android.support.v4.app.FragmentActivity
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.util.Log
import android.view.MotionEvent
@mreram
mreram / CameraFragment.kt
Created Aug 19, 2018
CameraFragment with some gestures and animations
View CameraFragment.kt
package eram.ir.camerapager
import android.os.Bundle
import android.support.v4.app.Fragment
import kotlinx.android.synthetic.main.camera_fragment.*
import android.view.*
import android.widget.FrameLayout
import android.animation.ValueAnimator
import android.content.res.Resources
import android.view.animation.DecelerateInterpolator
View BroadcastChannelTest.kt
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.consume
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
class BroadcastChannelTest {
@ExperimentalCoroutinesApi
companion object {
View StateFlowTest.kt
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
View StateFlowBroadcastTest.kt
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.broadcastIn
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
class StateFlowBroadcastTest {
@mreram
mreram / PrintActivity.java
Last active Nov 11, 2020
A sample code for Bixolon printer
View PrintActivity.java
package ir.eram.printexample;
import android.app.ProgressDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
View remap_keyboard_kubuntu
Remap Super(left) to ctrl left:
remove mod4 = Super_L
add control = Super_L
@mreram
mreram / bypass_script.sh
Created Mar 27, 2021
by pass an ip through vpn in ubuntu
View bypass_script.sh
DEV=enp4s0
GW=$(ip route list | sed "s/.* via \([0-9.]*\) dev $DEV.*/\1/;t;d"|head -1)
route add -host git.mycompany.com gw $GW $DEV