This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define UPDATE_ORIENTATION_NOTI CFSTR("iolate/UpdateOrientation") | |
static UIWindow* additionalWindow = nil; | |
static UIView* mainViewInWindow = nil; | |
static void updateOrientation(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { | |
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | |
int orientation_ = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | |
UITableViewHeaderFooterView *sectionHeaderView = nil; | |
if (section == 1) { | |
sectionHeaderView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"headerIndicatorView"]; | |
if (sectionHeaderView == nil) { | |
sectionHeaderView = [[UITableViewHeaderFooterView alloc] initWithReuseIdentifier:@"headerIndicatorView"]; | |
} | |
float indicatorSize = 21.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) addAppAsLoginItem { | |
if ([self wasAppAddedAsLoginItem]) return; | |
NSString * appPath = [[NSBundle mainBundle] bundlePath]; | |
// This will retrieve the path for the application | |
// For example, /Applications/test.app | |
CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:appPath]; | |
// Create a reference to the shared file list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Soribada.js | |
// BeardedSpice | |
// | |
// Created by iolate <[email protected]> on 2016. 12. 28.. | |
// Copyright © 2016 GPL v3 http://www.gnu.org/licenses/gpl.html | |
// | |
// http://www.soribada.com/ | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# shellinabox ssh wrapper | |
# -s /:nobody:nogroup:/:/path/to/sshwrapper.sh | |
echo "" | |
echo "Example: user@host[:22]" | |
read -p "Connect to: " connstr; | |
if ! [[ "$connstr" =~ "@" ]]; then | |
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -o pam_auth pam_auth.c -lpam | |
#include <security/pam_appl.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
int custom_converation(int num_msg, const struct pam_message** msg, struct pam_response** resp, void* appdata_ptr) { | |
// Provide password for the PAM conversation response that was passed into appdata_ptr | |
struct pam_response* reply = (struct pam_response* )malloc(sizeof(struct pam_response)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i markdown-it -D | |
var fs = require('fs'); | |
var md = require('markdown-it')(); | |
var input = fs.readFileSync('README.md', 'utf8'); | |
var output = md.render(input); | |
var html = `<!DOCTYPE html> | |
<html><head><meta charset="utf-8" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/sindresorhus/Preferences/issues/40 | |
// https://lapcatsoftware.com/articles/working-without-a-nib-part-10.html | |
import Cocoa | |
@objc protocol EditMenuActions { | |
func redo(_ sender: AnyObject) | |
func undo(_ sender: AnyObject) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method 1: Copy | |
let certificate = SecCertificateCreateWithData(kCFAllocatorDefault, derData as CFData) | |
// Method 2: No Copy | |
cert.withUnsafeBytes { unsafeBytes in | |
let bytes = unsafeBytes.bindMemory(to: UInt8.self).baseAddress! | |
let cFData = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, bytes, unsafeBytes.count, kCFAllocatorNull)! | |
let certificate = SecCertificateCreateWithData(kCFAllocatorDefault, cFData) | |
} |