This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Cassandra Data Import Tool - Offline CQL Generator | |
| - Reads local CSV dumps for source and target tables | |
| - Finds rows present in source but missing in target | |
| - Writes a CQL script with INSERT statements (optionally IF NOT EXISTS) | |
| - No direct Cassandra connection required | |
| Run: | |
| python3 generate_missing_inserts.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import os | |
| from datetime import datetime | |
| class Logger: | |
| _instance = None | |
| def __new__(cls, log_prefix='projectname', level=logging.INFO, log_folder='logs'): | |
| if cls._instance is None: | |
| cls._instance = super(Logger, cls).__new__(cls) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PersianNumbers { | |
| private static String[] persianNumbers = new String[]{ "۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹" }; | |
| public static String toPersianNumber(String text) { | |
| if (text.length() == 0) | |
| return ""; | |
| String out = ""; | |
| int length = text.length(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.app.Fragment; | |
| import android.content.Context; | |
| import android.os.Bundle; | |
| import android.support.annotation.Nullable; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import com.retrofitrealm.controllers.MainActivityInterface; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <alpha | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:duration="5000" | |
| android:fromAlpha="0.0" | |
| android:interpolator="@android:anim/accelerate_interpolator" | |
| android:toAlpha="1.0" > | |
| </alpha> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Gitlab projects | |
| git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d | |
| //or on Github projects: | |
| git branch --merged | grep -v '*' | xargs git branch -d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.annotation.SuppressLint; | |
| import android.content.Context; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapShader; | |
| import android.graphics.Canvas; | |
| import android.graphics.Color; | |
| import android.graphics.Paint; | |
| import android.graphics.Shader; | |
| import android.graphics.drawable.BitmapDrawable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //https://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ | |
| public class CircleTransform extends BitmapTransformation { | |
| public CircleTransform(Context context) { | |
| super(context); | |
| } | |
| @Override | |
| protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { | |
| return circleCrop(pool, toTransform); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| import time | |
| while True: | |
| print("Launching process..") | |
| p = subprocess.Popen("python3 script.py", shell=True) | |
| p.wait() | |
| print("Process crashed. Restarting in 2 seconds..") | |
| time.sleep(2) |
NewerOlder