Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Perceval Faramaz perfaram

🎯
Focusing
View GitHub Profile
@perfaram
perfaram / k3_keys.html
Created Oct 15, 2017
A backup of parhelia.ch's SMC key informations and structs declarations.
View k3_keys.html
<html><head>
<body>
<center><h1>SMC Keys</h1></center>
<center><h2>K3 Version: 1.30f1
</h2></center>
<p>
<table cellpadding="2" cellspacing="2" border="1" width="100%">
<tr>
<th align=middle>KEY</th>
<th align=middle>TYPE</th>
View SMCTypes.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>#KEY</key>
<string>ui32</string>
<key>+LKS</key>
<string>flag</string>
<key>AL!</key>
<string>ui8</string>
View SCMDescriptions.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>#KEY</key>
<string>Total key count</string>
<key>+LKS</key>
<string>Returns 3 bit value, where each bit represents one of the three lock bit regions.</string>
<key>AL!</key>
<string>ALS variables overriding</string>
View SMCKeys.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>T*</key>
<string>Temperature</string>
<key>V*</key>
<string>Voltage</string>
<key>I* (upper-case i, not lower-case L)</key>
<string>Intensity (current)</string>
@perfaram
perfaram / encode_ascii_as_dna.py
Last active Jul 19, 2017
Encoding ASCII text as DNA (quaternary base)
View encode_ascii_as_dna.py
def to_base(n, bse):
digs = "0123456789abcdefghijklmnopqrstuvwxyz"
tmp = []
while n:
n, i = divmod(n, bse)
tmp.append(digs[i])
return "".join(tmp[::-1])
def chng_frm_base(s, frm_bse, to_bse):
if to_bse < 2 or to_bse > 36 or frm_bse < 2 or frm_bse > 36:
View Swift - Dijkstra.swift
import UIKit
public class Vertex {
var key: String?
var neighbors: Array<Edge>
init() {
self.neighbors = Array<Edge>()
}
}
@perfaram
perfaram / semiprivate.md
Created Nov 21, 2015 — forked from tarcieri/semiprivate.md
Ed25519-based semi-private keys
View semiprivate.md

Semiprivate Keys

Semi-private keys are an expansion of the traditional idea of asymmetric keys, which have a public/private keypair, to N keys which can each represent a different capability level. In the degenerate case, a semi-private key system has 3 different types of keys. These are, to use the Tahoe terminology:

  • writecap: can publish new ciphertexts
  • readcap: can read/authenticate ciphertexts
View gist:ca3521ea832c69673bea
// Eric Wolfe: Added support for checking if mobile radios are enabled on the device
// Original source: http://www.enigmaticape.com/blog/determine-wifi-enabled-ios-one-weird-trick
#import <Foundation/Foundation.h>
#import <ifaddrs.h>
#import <net/if.h>
#import <SystemConfiguration/CaptiveNetwork.h>
@interface ERWNetworkStatus : NSObject
@perfaram
perfaram / checkerror.m
Created Jul 27, 2015
Function that extracts human-readable information from OSStatus codes.
View checkerror.m
//shamelessy taken from : https://github.com/Xcode-Snippets/Objective-C/blob/master/checkerror.m
static void CheckError(OSStatus error, const char *operation) {
if (error == noErr) {
return;
}
char str[20];
*(UInt32 *) (str + 1) = CFSwapInt32HostToBig(error);
if (isprint(str[1]) && isprint(str[2]) && isprint(str[3]) && isprint(str[4])) {
str[0] = str[5] = '\'';
View KBCollectionExtensions.h
//
// KBCollectionExtensions.h
//
// Created by Guy English on 25/02/08.
// Copyright 2008 Kickingbear. All rights reserved.
//
#import <Cocoa/Cocoa.h>
/*
You can’t perform that action at this time.