Skip to content

Instantly share code, notes, and snippets.

View Lessica's full-sized avatar

i_82 Lessica

View GitHub Profile
@Lessica
Lessica / new8.c
Created June 12, 2016 12:45
Operating System Pipe Testing Demo
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
@Lessica
Lessica / new9.c
Created June 12, 2016 13:24
Operating System Pipe Testing Demo 2
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <ctype.h>
int main(int argc, char *argv[])
@Lessica
Lessica / TimeMeasurementTargets.java
Created March 7, 2017 13:07
Advanced Algorithmics - TP01
package com.darwindev;
import java.awt.Shape;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
@Lessica
Lessica / build-idevicerestore.sh
Last active July 24, 2024 02:25
Build script for idevicerestore and all its dependencies for macOS.
#!/bin/sh
# Tested on macOS 12.0 / Xcode 13.3 / Homebrew 3.4.6-60-ge1c1157
# yum install python python-devel
# echo '[group_kdesig-cmake3_EPEL]
# name=Copr repo for cmake3_EPEL owned by @kdesig
# baseurl=https://copr-be.cloud.fedoraproject.org/results/@kdesig/cmake3_EPEL/epel-7-$basearch/
# type=rpm-md
# skip_if_unavailable=True
# gpgcheck=1
@Lessica
Lessica / keybase.md
Last active November 25, 2022 06:33

Keybase proof

I hereby claim:

  • I am lessica on github.
  • I am i_82 (https://keybase.io/i_82) on keybase.
  • I have a public key ASCy06m3w8FXUbMqOsPF9bMWnqKvgwv8OBhSQ2twF_YmvAo

To claim this, I am signing this object:

@Lessica
Lessica / EventGenerator.swift
Created April 26, 2020 15:05 — forked from zwaldowski/EventGenerator.swift
UIKit Touch Synthesis (Hacks! Hacks hacks! Hacks!)
import UIKit
import ObjectiveC.runtime
// MARK: - IOKit
@objc private protocol IOHIDEvent: NSObjectProtocol {}
private struct IOHIDDigitizerEventMask: OptionSet {
let rawValue: UInt32
init(rawValue: UInt32) { self.rawValue = rawValue }
@Lessica
Lessica / ReadWriteLock.swift
Last active April 17, 2021 13:42
ReadWriteLock: pthread_rwlock_t wrapper in Swift
import Foundation
final class ReadWriteLock {
private var rwlock: pthread_rwlock_t = {
var rwlock = pthread_rwlock_t()
pthread_rwlock_init(&rwlock, nil)
return rwlock
}()
func writeLock() {
@Lessica
Lessica / MutexLock.swift
Created April 17, 2021 13:42
MutexLock: pthread_mutex_t wrapper in Swift
import Foundation
final class MutexLock {
private var mutex: pthread_mutex_t = {
var mutex = pthread_mutex_t()
pthread_mutex_init(&mutex, nil)
return mutex
}()
func tryLock() -> Bool {
@Lessica
Lessica / MyStackView.swift
Created April 17, 2021 16:30
Make toggleSidebar(_:) available again while firstResponder locates inside nested NSSplitView
import Cocoa
class MyStackView: NSStackView {
override func responds(to aSelector: Selector!) -> Bool {
if aSelector == #selector(NSSplitViewController.toggleSidebar(_:)) {
return false
}
return super.responds(to: aSelector)
}
@Lessica
Lessica / CheckboxHeaderCell.swift
Last active March 11, 2024 13:26
A Checkbox Cell in NSTableView Column Header
//
// CheckboxHeaderCell.swift
//
// Created by Rachel on 2021/4/26.
// Original: https://stackoverflow.com/questions/11961869/checkbox-in-nstableview-column-header
//
import Cocoa
class CheckboxCell: NSButtonCell {