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
import Cocoa | |
import Foundation | |
@discardableResult | |
func acquirePrivileges() -> Bool { | |
let accessEnabled = AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary) | |
if accessEnabled != true { | |
print("You need to enable the keylogger in the System Prefrences") |
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 DNSResolveerRunLoopObserverCallBack(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) { | |
switch (activity) { | |
case kCFRunLoopEntry: | |
NSLog(@"kCFRunLoopEntry"); | |
break; | |
case kCFRunLoopBeforeTimers: | |
NSLog(@"kCFRunloopBeforeTimers"); | |
break; | |
case kCFRunLoopBeforeSources: | |
NSLog(@"kCFRunLoopBeforeSources"); |
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
/* ASN.1 data display code, copyright Peter Gutmann | |
<[email protected]>, based on ASN.1 dump program by David Kemp, | |
with contributions from various people including Matthew Hamrick, Bruno | |
Couillard, Hallvard Furuseth, Geoff Thorpe, David Boyce, John Hughes, | |
'Life is hard, and then you die', Hans-Olof Hermansson, Tor Rustad, | |
Kjetil Barvik, James Sweeny, Chris Ridd, David Lemley, John Tobey, James | |
Manger, Igor Perminov, and several other people whose names I've | |
misplaced. | |
Available from http://www.cs.auckland.ac.nz/~pgut001/dumpasn1.c. Last |
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
NSString *dylibPath = @"/Users/billzhao/Desktop/libRulesActions.dylib"; | |
const char *libPath = [dylibPath cStringUsingEncoding:NSUTF8StringEncoding]; | |
void *dl = dlopen(libPath, RTLD_NOW); | |
const char *dlErr = dlerror(); | |
if (dlErr) { | |
NSLog(@"dlerror() = %s", dlErr); | |
} else { | |
NSLog(@"dylib path is %s, dl = %p", libPath, dl); | |
} | |
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
#!/usr/bin/python | |
class Perceptron(object): | |
def __init__(self, input_num, activator): | |
''' | |
初始化感知器,设置输入参数的个数,以及激活函数。 | |
激活函数的类型为double -> double | |
''' | |
self.activator = activator | |
# 权重向量初始化为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
#!/bin/bash | |
# redirect STDOUT to a file (note the single > -- this will truncate /tmp/outfile) | |
exec 1> /tmp/outfile | |
echo Now all STDOUT from each subsiquent command will | |
echo be redirected to /tmp/outfile | |
echo but not STDERR >&2 | |
# redirect STDERR to STDOUT and append (note the double >>) both to /tmp/outfile |
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
#include<netinet/in.h> | |
#include<stdio.h> | |
#include<stdlib.h> | |
#include<sys/socket.h> | |
#include<sys/stat.h> | |
#include<sys/types.h> | |
#include<unistd.h> | |
int main() { | |
int create_socket, new_socket; |
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
# Path to Oh My Fish install. | |
set -q XDG_DATA_HOME | |
and set -gx OMF_PATH "$XDG_DATA_HOME/omf" | |
or set -gx OMF_PATH "$HOME/.local/share/omf" | |
# Load Oh My Fish configuration. | |
source $OMF_PATH/init.fish | |
set -x PATH $PATH ~/GitRepo/depot_tools | |
set -x PATH $PATH ~/.cargo/bin |
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
extension CharacterSet { | |
var characters:[UnicodeScalar] { | |
var chars = [UnicodeScalar]() | |
for plane:UInt8 in 0...16 { | |
if self.hasMember(inPlane: plane) { | |
let p0 = UInt32(plane) << 16 | |
let p1 = (UInt32(plane) + 1) << 16 | |
for c:UInt32 in p0..<p1 { | |
if let us = UnicodeScalar(c) { | |
if self.contains(us) { |
NewerOlder