Skip to content

Instantly share code, notes, and snippets.

@schukin
schukin / read-access.sql
Created May 13, 2020 05:25 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@schukin
schukin / .aliases
Created May 22, 2019 23:05
Git Yolo
git_commit_everything () {
git add .
git status
NEXT_COMMIT_MESSAGE=`curl -s http://whatthecommit.com | perl -p0e '($_)=m{<p>(.+?)</p>}s'`
echo $NEXT_COMMIT_MESSAGE
git commit -m "[WIP] $NEXT_COMMIT_MESSAGE"
}
alias yolo=git_commit_everything
@schukin
schukin / SuperViewController.m
Created April 12, 2019 03:32
Command+Shift+period hook
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
@protocol CommandShiftPeriodable <NSObject>
- (void)commandShiftPeriodPressed;
@end
@interface SuperViewController : UIViewController <CommandShiftPeriodable>
@schukin
schukin / gist:613a43edf8410e0b8b6f
Created July 1, 2014 21:43
Auto Layout with translatesAutoresizingMaskIntoConstraints = NO
#import "DSXViewController.h"
@interface DSXView3 : UIView
@property (nonatomic) UIView *dsxView4;
@end
@implementation DSXView3
- (instancetype)init
{
Timer based...
(Create a scheduled NSTimer then invalidate it)
(# of timers, total time, time per timer)
1 0.000080 0.000080
10 0.000087 0.000009
100 0.000425 0.000004
1000 0.003176 0.000003
10000 0.030586 0.000003
100000 0.302724 0.000003
1000000 3.071473 0.000003