Skip to content

Instantly share code, notes, and snippets.

@Danesz
Danesz / TLSSocketFactory.java
Created March 6, 2017 08:09 — forked from Kishanjvaghela/TLSSocketFactory.java
Custom SSLSocketFactory Implementation to enable tls 1.1 and tls 1.2 for android 4.1 (16+)
package net.cogindo.ssl;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
@Danesz
Danesz / EndlessRecyclerOnScrollListener.java
Created June 9, 2017 06:20 — forked from mustafasevgi/EndlessRecyclerOnScrollListener.java
RecyclerView position helper to get first and last visible positions
/**
* Custom Scroll listener for RecyclerView.
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessScrollListener";
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
@Danesz
Danesz / EndlessRecyclerOnScrollListener.java
Created June 9, 2017 06:21 — forked from ssinss/EndlessRecyclerOnScrollListener.java
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@Danesz
Danesz / T2.keys
Created March 17, 2020 17:23 — forked from xerub/T2.keys
=== iBridge2,1,iBridge2,3,iBridge2,4,iBridge2,5,iBridge2,7,iBridge2,8_3.5_16P5200_Restore.ipsw
Firmware/dfu/iBEC.j137.RELEASE.im4p
3723c95ba25706b4650a92177afc28af57e0a236fd0e46b83cffb6140392b63355562b5ed671bda6b5929ff728f0b324
Firmware/dfu/iBSS.j140k.RELEASE.im4p
34d7aa36e00b5c772bf7381c821253a714ed2714552a48a478b391faac32bc0eef2577d5a04e01f462648754eb9af69e
Firmware/dfu/iBSS.j137.RELEASE.im4p
4bb3ecf8b19401a009b5c0003b64ac3bae8258f6d9c42b91831927e348957dfde01384caa3fbee1b6e665d168b46fc47
Firmware/dfu/iBEC.j680.RELEASE.im4p
893d17aa768a6ebd8f85b4251ef8f692c766f7b1868bd974a3dc9fcd0dd9608e4e0709bd9208752d9515a636c129378c
@Danesz
Danesz / CameraViewController.swift
Created May 14, 2020 21:39
CameraViewController.swift - AVCaptureSession
let session = AVCaptureSession()
@Danesz
Danesz / CameraViewController.swift
Last active May 14, 2020 21:42
CameraViewController.swift - init
var deviceInput: AVCaptureDeviceInput!
session.sessionPreset = AVCaptureSession.Preset.vga640x480
// acquire the camera device
guard let device = AVCaptureDevice
.default(AVCaptureDevice.DeviceType.builtInWideAngleCamera,
for: .video,
position: AVCaptureDevice.Position.front) else {
return
@Danesz
Danesz / CameraViewController.swift
Created May 14, 2020 21:44
CameraViewController.swift - captureOutput
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
// do stuff here with the video
}
@Danesz
Danesz / CameraViewController.swift
Created May 14, 2020 21:45
CameraViewController.swift - photoOutput
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
//process single image
guard let imageData = photo.fileDataRepresentation()
else { return }
let captureImageView = UIImageView(frame: CGRect(x: 50, y: 50, width: 100, height: 100))
let image = UIImage(data: imageData)
captureImageView.image = image
//show the captured image
@Danesz
Danesz / CameraViewControllerHidden.swift
Created May 14, 2020 21:47
CameraViewControllerHidden.swift - init
// ...
do {
deviceInput = try AVCaptureDeviceInput(device: captureDevice)
guard deviceInput != nil else {
print("error: can't get deviceInput")
return
}
if self.session.canAddInput(deviceInput){
self.session.addInput(deviceInput)
@Danesz
Danesz / Tweak.x
Created May 14, 2020 21:50
AVCaptureSession Jailbreak hook
#import <UIKit/UIKit.h>
%hook SpringBoard
-(void) applicationDidFinishLaunching:(id)arg {
%orig(arg);
UIAlertView *lookWhatWorks = [[UIAlertView alloc] initWithTitle:@"PrivacyGuard Tweak"
message:@"Your privacy guard is running 😎"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];