Skip to content

Instantly share code, notes, and snippets.

@avargaskun
avargaskun / SVG.swift
Last active May 7, 2024 08:42 — forked from ollieatkinson/SVG.swift
Utilise the private CoreSVG framework in Swift
import Darwin
import Foundation
import UIKit
@objc
class CGSVGDocument: NSObject { }
var CGSVGDocumentRetain: (@convention(c) (CGSVGDocument?) -> Unmanaged<CGSVGDocument>?) = load("CGSVGDocumentRetain")
var CGSVGDocumentRelease: (@convention(c) (CGSVGDocument?) -> Void) = load("CGSVGDocumentRelease")
var CGSVGDocumentCreateFromData: (@convention(c) (CFData?, CFDictionary?) -> Unmanaged<CGSVGDocument>?) = load("CGSVGDocumentCreateFromData")
#define RELAY_PIN (8)
void setup() {
// put your setup code here, to run once:
SERIAL_PORT_USBVIRTUAL.begin(115200); // open serial connection via USB-Serial
pinMode(RELAY_PIN, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
@Cdaprod
Cdaprod / raspberrypi_hostapd_network_setup.md
Created January 25, 2024 22:46
To make your Raspberry Pi Zero 2 W broadcast a `hostapd` network upon powering on, you'll need to install and configure `hostapd` and `dnsmasq`, and set up a static IP for the wireless interface. Here's a detailed guide on how to achieve this:

To make your Raspberry Pi Zero 2 W broadcast a hostapd network upon powering on, you'll need to install and configure hostapd and dnsmasq, and set up a static IP for the wireless interface. Here's a detailed guide on how to achieve this:

Task Creation Chain

  1. Install Necessary Packages: Install hostapd and dnsmasq.
  2. Configure Static IP for WLAN: Set a static IP for the wireless interface.
  3. Configure Hostapd: Set up the access point details.
  4. Configure Dnsmasq: Set up the DHCP server.
  5. Enable Services on Boot: Ensure hostapd and dnsmasq start on boot.
@wojteklu
wojteklu / clean_code.md
Last active May 7, 2024 08:41
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@alessio
alessio / Homebrew in a multi-user environment.md
Created January 13, 2024 22:13 — forked from claui/Homebrew in a multi-user environment.md
Using Homebrew on macOS in a multi-user environment

I’ve had success using Homebrew in a multi-user environment the following way:

Create a shared Homebrew user

Create a new (non-GUI) user, group and home directory:

sudo /usr/sbin/sysadminctl -addUser brew \
  -fullName 'Homebrew' -admin -home /var/brew \
  -password - -UID 430 \

GitHub Search Syntax for Finding API Keys/Secrets/Tokens

As a security professional, it is important to conduct a thorough reconnaissance. With the increasing use of APIs nowadays, it has become paramount to keep access tokens and other API-related secrets secure in order to prevent leaks. However, despite technological advances, human error remains a factor, and many developers still unknowingly hardcode their API secrets into source code and commit them to public repositories. GitHub, being a widely popular platform for public code repositories, may inadvertently host such leaked secrets. To help identify these vulnerabilities, I have created a comprehensive search list using powerful search syntax that enables the search of thousands of leaked keys and secrets in a single search.

Search Syntax:

(path:*.{File_extension1} OR path:*.{File_extension-N}) AND ({Keyname1} OR {Keyname-N}) AND (({Signature/pattern1} OR {Signature/pattern-N}) AND ({PlatformTag1} OR {PlatformTag-N}))

Examples:

**1.

@endolith
endolith / readme.md
Last active May 7, 2024 08:38
Sethares dissmeasure function in Python

Adaptation of Sethares' dissonance measurement function to Python

Example is meant to match the curve in Figure 3:

Figure 3

Original model used products of the two amplitudes a1⋅a2, but this was changed to minimum of the two amplitudes min(a1, a2), as explained in G: Analysis of the Time Domain Model appendix of Tuning, Timbre, Spectrum, Scale.

This weighting is incorporated into the dissonance model (E.2) by assuming that the roughness is proportional to the loudness of the beating. ... Thus, the amplitude of the beating is given by the minimum of the two amplitudes.

@duycong2509
duycong2509 / opcache.ini
Created May 7, 2024 08:36 — forked from rohankhudedev/opcache.ini
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@pedro-mass
pedro-mass / Setting-up-Semantic-Release.md
Last active May 7, 2024 08:36
Setting up semantic-release with commit linter and commit message helper