Skip to content

Instantly share code, notes, and snippets.

View HsiangHo's full-sized avatar
🏡
Working from home

Xiang He HsiangHo

🏡
Working from home
View GitHub Profile
@insidegui
insidegui / WebCacheCleaner.swift
Created September 14, 2016 23:12
Clear WKWebView's cookies and website data storage, very useful during development.
import Foundation
import WebKit
final class WebCacheCleaner {
class func clean() {
HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
print("[WebCacheCleaner] All cookies deleted")
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
@subharanjanm
subharanjanm / clamav-mac.md
Created August 30, 2016 14:16 — forked from dkobia/clamav-mac.md
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so

static func make(withKeychainItem keychainItem: SecKeychainItem) -> Credentials? {
var attributeTags = [SecItemAttr.accountItemAttr.rawValue]
var formatConstants = [UInt32(CSSM_DB_ATTRIBUTE_FORMAT_STRING)]
var attributeInfo = SecKeychainAttributeInfo(count: 1, tag: &attributeTags, format: &formatConstants)
var attributeList: UnsafeMutablePointer<SecKeychainAttributeList>? = nil
var passwordLength: UInt32 = 0
var passwordPointer: UnsafeMutablePointer<Void>? = nil
let status = SecKeychainItemCopyAttributesAndData(keychainItem,
@takuoka
takuoka / AutoGrowingTextField.swift
Last active January 18, 2022 13:02
Example of an NSTextField that expands its height automatically. https://github.com/DouglasHeriot/AutoGrowingNSTextField
import Cocoa
// https://github.com/DouglasHeriot/AutoGrowingNSTextField
// for AutoLayout
class AutoGrowingTextField: NSTextField {
var minHeight: CGFloat? = 100
@landonf
landonf / setting-up-unfsd.txt
Created October 7, 2015 18:45
unfsd example
landonf@zul:/tmp> cat macports-root-export
/ 127.0.0.1(ro,insecure,fixed)
landonf@zul:/tmp> unfsd -e /tmp/macports-root-export -d -l 127.0.0.1 -n 3248 -m 3248 -p&
[1] 15060
landonf@zul:/tmp> UNFS3 unfsd 0.9.22 (C) 2006, Pascal Schmidt <unfs3-server@ewetel.net>
/: ip 127.0.0.1 mask 255.255.255.255 options 16
landonf@zul:/tmp> mkdir /tmp/nfs-mount-root
storefront = {
'AL':'143575',
'DZ':'143563',
'AO':'143564',
'AI':'143538',
'AG':'143540',
'AR':'143505',
'AM':'143524',
'AU':'143460',
'AT':'143445',
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 8, 2024 10:07
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@indragiek
indragiek / main.c
Created November 29, 2012 01:10
Simple key logger for OS X using CGEventTap
// Super simple key logger that uses a CGEventTap to log
// the unicode strings for each key down event
// Doesn't handle special keys (enter, backspace, etc.)
#include <stdio.h>
#import <Carbon/Carbon.h>
#import <ApplicationServices/ApplicationServices.h>
CGEventRef loggerCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void* context)
{