Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Behrouz Khezry bkhezry

🏠
Working from home
View GitHub Profile
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/ahmad/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
View gist:befa491a43e412d34bfc0b4bf7c2c96f
فه ره نجی پۆش
فه‌ره‌نجی پۆش! که‌ڵپۆس له کۆڵ!
بۆ تۆ گه‌ڕاوم دۆڵ به دۆڵ
هه‌ردا و هه‌ردم کرد ده‌شت و کۆ
نامه ژێر پێ گه‌ڕام بۆ تۆ
له دارستان له کانی و ئاو
له گشت لا تۆم هاته به‌ر چاو
گرتم شوێنی هه‌نگاوه‌که‌ت
پرسیم سۆراغی چاوه‌که‌ت
@bkhezry
bkhezry / main.dart
Created Jul 31, 2020
Half screen with two listview
View main.dart
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@bkhezry
bkhezry / BaseActivity.java
Created Feb 2, 2020
Fix dark mode problem with i18n
View BaseActivity.java
@Override
public void applyOverrideConfiguration(@Nullable Configuration overrideConfiguration) {
if (overrideConfiguration != null) {
int uiMode = overrideConfiguration.uiMode;
overrideConfiguration.setTo(getBaseContext().getResources().getConfiguration());
overrideConfiguration.uiMode = uiMode;
}
super.applyOverrideConfiguration(getResources().getConfiguration());
}
View LocationService.java
package com.github.bkhezry.buildingcollection.service;
import android.app.IntentService;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
@bkhezry
bkhezry / EncodingSRT.bash
Created Mar 16, 2019
Change encoding of subtitle to UTF-8 in the linux terminal
View EncodingSRT.bash
iconv -f CP1256 -t UTF-8 input.srt -o output.srt
View RequestToken.java
//Request google sign in
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
//Get selected account data
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
View GoogleSignInFunction.java
private void setUpGoogleSignIn() {
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
}
View logcat-shuffle.txt
1-28 13:02:11.695 4664-5179/? E/ImageLoader: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x67d71af8: Failure in SSL library, usually a protocol error
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x5dc84d5c:0x00000000)
javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x67d71af8: Failure in SSL library, usually a protocol error
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x5dc84d5c:0x00000000)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:448)
at com.android.okhttp.Connection.upgradeToTls(Connection.java:146)
at com.android.okhttp.Connection.connect(Connection.java:107)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(
View shuffle.html
<title>Shuffle</title>
<meta name="description" content="Shuffle is the easiest way to listen to the Persian music you love. Totally free.">
<script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-NM4T2VK",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script><link href="/opensearch.xml" rel="search" title="shuffle" type="application/opensearchdescription+xml"><meta name="google" content="notranslate"><link href="/static/css/main.b9b045b9.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NM4T2VK" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div id="root"></div><script type="text/javascript" src="/static/js/main.21011b5d.js"></script></body><script async src=