Skip to content

Instantly share code, notes, and snippets.

View fel-cesar's full-sized avatar
💻

Felipe Cesar fel-cesar

💻
View GitHub Profile
@fel-cesar
fel-cesar / CaptureTrapCtrlC.sh
Created February 14, 2019 20:59
Sample script to demonstrate how to capture a 'trap' command in terminal
#!/bin/bash
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
function ctrl_c() {
echo "** Trapped CTRL-C"
exit 1
}
@fel-cesar
fel-cesar / change_commit_date.sh
Last active October 12, 2018 21:28
This snippet is meant to ovewrite the author and committer date locally . BEFORE PUSHED!!!!!! Remember to change the <COMMIT_HASH> adn the <NEW_DATE> according to the defined format. It is advised to backup your repository locally before using the sc
#DATE FORMAT - e.g. 'Mon Jun 19 21:20:50 2017 -0300'
git filter-branch --env-filter \
'if [ $GIT_COMMIT = <COMMIT_HASH> ]
then
export GIT_AUTHOR_DATE=“<NEW_DATE>"
export GIT_COMMITTER_DATE="<NEW_DATE>"
fi' -f
#import <Foundation/Foundation.h>
@protocol CRUploadProgressDelegate <NSObject>
-(void) didUploadBytes:(long) bytes;
@optional
-(BOOL) didCancelUpload;
@end
#import <Foundation/Foundation.h>
@protocol CRAuthenticationDelegate <NSObject>
@optional
-(void) authDidStart:(NSDictionary<NSString*,NSString*> *) service;
-(void) authDidFinish:(NSDictionary<NSString*,NSString*> *) service;
-(void) authDidCancel:(NSDictionary<NSString*,NSString*> *) service;
@end
// SwiftViewController.swift
// PrototypeApplication
//
// Created by Felipe César Silveira de Assis on 12/12/17.
// Copyright © 2017 CloudRail. All rights reserved.
//
import UIKit
import CloudrailSI
// SwiftViewController.swift
// PrototypeApplication
//
// Created by Felipe César Silveira de Assis on 12/12/17.
// Copyright © 2017 CloudRail. All rights reserved.
//
import UIKit
import CloudrailSI
["airport",
"atm",
"amusement_park",
"aquarium",
"art_gallery",
"bakery",
"bank",
"bar",
"beauty_salon",
"bicycle_store",
-(void)viewDidAppear:(BOOL)animated{
self.box = [[CRBox alloc] initWithClientId:@"" clientSecret:@""];
NSString * restored_state = [NSUserDefaults.standardUserDefaults objectForKey:@"box_state"];
if (restored_state != nil ) {
[self.box loadAsString:restored_state];
NSString * userName = [self.box userName];
NSString * userLogin = [self.box userLogin];
NSLog(@"%@ - %@", userName, userLogin);
@fel-cesar
fel-cesar / strip-framework.sh
Created October 23, 2017 04:47
Script to add in build phases in order to remove not used archs in a FAT Framework. (Xcode)
echo "Target architectures: $ARCHS"
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")
@fel-cesar
fel-cesar / fix_commit_date.sh
Last active July 20, 2017 18:44
This gist is for fixing past commits date, be careful because all the subsequent hashes will be also changed. ALWAYS make backup before doing so
git filter-branch --env-filter \
'if [ $GIT_COMMIT = <COMMIT_HASH> ]
then
export GIT_AUTHOR_DATE=“Mon Jun 19 21:20:50 2017 -0300"
export GIT_COMMITTER_DATE="<CHANGE DATE ON THE FORMAT ABOVE>"
fi' -f