Skip to content

Instantly share code, notes, and snippets.

View odemolliens's full-sized avatar

@odemolliens odemolliens

View GitHub Profile
@skymobilebuilds
skymobilebuilds / carthage-xc12.sh
Last active May 17, 2022 12:36
Xcode 13 and 12 Carthage Build Workaround
#!/bin/bash -e
echo "🤡 Applying carthage 12 and 13 workaround 🤡"
xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3)
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' > $xcconfig
echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
@dezren39
dezren39 / get-npm-package-version
Last active November 28, 2022 16:30 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# these can all be npm scripts, but anything can be an npm script
# a
echo $(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
# b
echo $(cat ./package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed -E 's/(version)|[:,\",]//g' | tr -d '[[:space:]]')
# c
echo $(node --eval="process.stdout.write(require('./package.json').version)")
@joncardasis
joncardasis / jailbreak_protect.c
Last active May 26, 2024 22:38
iOS - Prevent debugger attachment in a jailbroken environment. Obfuscated by assembly and symbol mangling.
//
// jailbreak_protect.c
//
// Created by Jonathan Cardasis (C) on 10/11/19.
// Copyright © 2019 Jonathan Cardasis (C). All rights reserved.
//
// Source: https://medium.com/@joncardasis/mobile-security-jailbreak-protection-84aa0fbc7b23
// Simply include this file in your project and ensure the file's Target Membership
// is set to your app.
@arslanbilal
arslanbilal / multipleRequest.swift
Last active August 21, 2023 21:55
Multiple Request with Dispatch Group
let firstRequestGroup = DispatchGroup()
let secondRequestGroup = DispatchGroup()
for () {
requestGroup.enter()
firstRequest() {
print("DEBUG: FIRST Request")
if success {
requestGroup.enter()
secondRequest() {
@EQuimper
EQuimper / clear.txt
Created June 16, 2017 16:17
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@VictorZhang2014
VictorZhang2014 / RSACryptographic.h
Last active August 25, 2021 05:22
RSACryptographic, a set of RSA encryption/decryption for iOS/Mac OS
#import <Foundation/Foundation.h>
@interface RSACryptographic : NSObject
- (void)loadPublicKeyFromFile:(NSString*)derFilePath;
- (void)loadPublicKeyFromData:(NSData*)derData;
- (void)loadPrivateKeyFromFile:(NSString*)p12FilePath password:(NSString*)p12Password;
- (void)loadPrivateKeyFromData:(NSData*)p12Data password:(NSString*)p12Password;
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@geoffreydhuyvetters
geoffreydhuyvetters / react_fiber.md
Last active January 13, 2023 06:49
What is React Fiber? And how can I try it out today?
@odemolliens
odemolliens / gist:a948bafbaf06bbf8c72f993cdfb1395d
Created December 12, 2016 14:52 — forked from reixa00/gist:94543264bbe3b9d94d26
Shared OkHttp application Interceptor that will add or intercept E-Tag hash for ALL requests on client instance
// by Nikola Despotoski
import android.content.Context;
import android.text.TextUtils;
import com.squareup.okhttp.Headers;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
@jkubecki
jkubecki / ExportKindle.js
Last active June 1, 2024 22:51
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {