This file contains 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
package com.activity | |
import android.graphics.Color | |
import android.graphics.DashPathEffect | |
import android.os.Bundle | |
import android.support.v7.app.AppCompatActivity | |
import com.github.mikephil.charting.charts.LineChart | |
import com.github.mikephil.charting.components.Legend | |
import com.github.mikephil.charting.components.LimitLine | |
import com.github.mikephil.charting.components.LimitLine.LimitLabelPosition |
This file contains 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
fun hashAndSavePasswordHash(context: Context, clearPassword: String) { | |
val digest = MessageDigest.getInstance("SHA-1") | |
val result = digest.digest(clearPassword.toByteArray(Charsets.UTF_8)) | |
val sb = StringBuilder() | |
for (b in result) { | |
sb.append(String.format("%02X", b)) | |
} | |
val hashedPassword = sb.toString() | |
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context) | |
val editor = sharedPref.edit() |
This file contains 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
# apt-get install build-essential python-dev libnetfilter-queue-dev | |
# pip install NetfilterQueue | |
# sudo apt-get install python-netfilterqueue | |
# iptables -F | |
# iptables -F -t nat | |
# iptables -I FORWARD -j NFQUEUE --queue-num 0 | |
# arpspoof -i eth0 192.168.1.200 -t 192.168.1.1 | |
# arpspoof -i eth0 192.168.1.1 -t 192.168.1.200 | |
from netfilterqueue import NetfilterQueue |
This file contains 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
fun createAndWritePdf() { | |
initPdfDocument() | |
writeToPdfDocument("One line...") | |
writeToPdfDocument("Another line...") | |
closePdfDocument() | |
savePdfDocument() | |
} | |
lateinit var document : PdfDocument |
This file contains 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
fun encrypt(context:Context, strToEncrypt: String): ByteArray { | |
val plainText = strToEncrypt.toByteArray(Charsets.UTF_8) | |
val keygen = KeyGenerator.getInstance("AES") | |
keygen.init(256) | |
val key = keygen.generateKey() | |
saveSecretKey(context, key) | |
val cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING") | |
cipher.init(Cipher.ENCRYPT_MODE, key) | |
val cipherText = cipher.doFinal(plainText) |
This file contains 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
package com.example.myapplication | |
import android.os.Bundle | |
import androidx.fragment.app.Fragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.fragment.app.viewModels | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData |
This file contains 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
package com.example.myapplication | |
import android.os.Bundle | |
import androidx.fragment.app.Fragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.fragment.app.viewModels | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData |
This file contains 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
from pytube import YouTube | |
import os | |
yt = YouTube('https://www.youtube.com/watch?v=PEnwXYJcSZc') | |
#yt.streams.get_audio_only().download() | |
video = yt.streams.filter(only_audio=True).first() | |
destination = '.' |
This file contains 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 os | |
import random | |
import time | |
from datetime import datetime | |
def log_to_results(str_to_log): | |
fr = open("results.txt", "a") | |
fr.write(str_to_log + "\n") | |
fr.close() |
This file contains 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
package com.activity | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.activity_statistiques.* | |
class StatsActivity : BaseActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
NewerOlder