Skip to content

Instantly share code, notes, and snippets.

View cbrevik's full-sized avatar
🙈

Christian Brevik cbrevik

🙈
View GitHub Profile
@cbrevik
cbrevik / config.fish
Created April 8, 2019 12:37
Fishshell config
# just the most essential stuff
abbr ga 'git add'
abbr gs 'git status'
abbr gb 'git branch'
abbr gcom 'git commit'
abbr gd 'git difftool --no-prompt'
abbr gdd 'git difftool --dir-dif'
abbr gco 'git checkout'
abbr gpr 'git pull --rebase'
int day = int.Parse(ssn.Substring(0, 2));
int month = int.Parse(ssn.Substring(2, 2));
int year = int.Parse(ssn.Substring(4, 2));
int ruleNumber = int.Parse(ssn.Substring(6, 3));
int birthYear = 0;
// Rule 1. 500–749: 1854–1899
if (year >= 54 && ruleNumber >= 500 && ruleNumber <= 749)
{
birthYear = 1800 + year;
int birthYear = (ruleNumber, year) switch
{
// Rule 1. 500–749: 1854–1899
(>= 500 and <= 749, >= 54) => 1800 + year,
// Rule 2. 000–499: 1900–1999
(< 500, _) => 1900 + year,
// Rule 3. 900–999: 1940–1999
(>= 900, >= 40) => 1900 + year,
// Rule 4. 500–999: 2000–2039
(>= 500, <= 39) => 2000 + year,
int firstDigit = int.Parse(ssn.Substring(0, 1));
int thirdDigit = int.Parse(ssn.Substring(2, 1));
string type = (firstDigit, thirdDigit) switch
{
(8 or 9, _) => "FH",
( >= 4 and <= 7, _) => "D",
  (_, 4 or 5) => "H",
_ => null
};
@cbrevik
cbrevik / ios_bundle.sh
Last active October 17, 2020 21:26
RN iOS bundle command
npx react-native bundle
--platform ios
--dev false
--reset-cache
--entry-file index.js
--bundle-output main.jsbundle
@cbrevik
cbrevik / android_bundle.sh
Created October 17, 2020 21:28
RN Android bundle command
npx react-native bundle
--platform android
--dev false
--reset-cache
--entry-file index.js
--bundle-output index.android.bundle
@cbrevik
cbrevik / hermes_bytecode.sh
Created October 17, 2020 21:32
RN Hermes Bytecode Generation
./node_modules/hermes-engine/osx-bin/hermesc
-emit-binary
-out android.bytecode.hbc
index.android.bundle
@cbrevik
cbrevik / ios-code-resigning.sh
Last active October 17, 2020 21:55
RN iOS code re-signing
rm -rf Payload/MyApp.app/\_CodeSignature
codesign -d
--entitlements :- "Payload/MyApp.app"
> entitlements.plist
codesign -f
-s "<My Certificate Name In Keychain>"
--entitlements entitlements.plist Payload/MyApp.app
@cbrevik
cbrevik / rn-android-resigning.sh
Created October 17, 2020 22:05
RN Android code-resigning
jarsigner
-keystore <keystore-name>.jks
-storepass '<storepass>'
-keypass '<keypass>'
-sigalg MD5withRSA
-digestalg SHA1
-signedjar myapp-signed.apk
myapp-modified.apk
<key alias>
@cbrevik
cbrevik / realign-apk.sh
Created October 17, 2020 22:10
Re-align signed apk
~/Library/Android/sdk/build-tools/29.0.2/zipalign
-f 4
myapp-signed.apk
myapp-signed-realigned.apk