Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View daluu's full-sized avatar

David Luu daluu

View GitHub Profile
package appiumworkaround;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
jeffehobbs /
Last active February 1, 2024 20:24
Get ADC WeatherKit token for REST API
# // // Nov. 2022
# from documentation here, which you should read first:
# 1. Have a valid ADC acount.
# 2. Download this script, and open it in a text editor. You'll have to change three variables.
# 3. Make up a reverse-domain name service ID (i.e., Place this in SERVICE_ID.
# 4. Create an ADC service identifier.
# 5. Create an ADC service key.
# 6. Download that service key, rename to 'wkservicekey.p8', and move it into same directory as this script.
ibireme / kpc_demo.c
Last active April 23, 2024 02:35
A demo shows how to read Intel or Apple M1 CPU performance counter in macOS.
// =============================================================================
// XNU kperf/kpc demo
// Available for 64-bit Intel/Apple Silicon, macOS/iOS, with root privileges
// Demo 1 (profile a function in current thread):
// 1. Open directory '/usr/share/kpep/', find your CPU PMC database.
// M1 (Pro/Max/Ultra): /usr/share/kpep/a14.plist
// M2 (Pro/Max): /usr/share/kpep/a15.plist
// M3: /usr/share/kpep/as1.plist
blotus /
Last active December 29, 2023 12:24
IPs exploiting the log4j2 CVE-2021-44228 detected by the crowdsec community

This list is no longer updated, thus the information is no longer reliable.

You can see the latest version (from october 2022) here

hosuaby / cypress-partial.js
Created December 3, 2021 20:14
Primitive load-balancer to run Cypress specs in parallel on CI without recording
* Primitive load-balancer to split Cypress specs across multiple runners. This script assumes that
* all your specs are in the folder '<project root>/cypress/integration'. It uses the number of
* tests per spec file as sole criteria to split specs between runners.
* This script accepts two arguments: the total number of runners and the index (starting from 0) of
* the current runner. Example:
* $ node cypress-partial.js 5 2
* This command asks for specs to give to the third runner of five runners.
* The output of the script is a coma-separated list of specs that can be given to Cypress. Example:
Map<String, Object> args = new HashMap<>();
args.put("direction", "up");
driver.executeScript("mobile: swipe", args);
MobileElement source = (MobileElement) new WebDriverWait(driver, 30)
driver.addCommand(HttpMethod.POST, String.format("/session/%s/plugin/actions/swipe", driver.getSessionId()), "swipe");
driver.execute("swipe", ImmutableMap.of("elementId", source.getId(), "percentage", 50));
MobileElement slider = driver.findElementByAccessibilityId("slider");
Point source = slider.getLocation();
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence sequence = new Sequence(finger, 1);
PointerInput.Origin.viewport(), source.x, source.y));
sequence.addAction(new Pause(finger, ofMillis(600)));
xgqfrms / apple m1
Last active February 21, 2023 19:44
apple m1 navigator.userAgent

apple m1 navigator.userAgent


// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36

The User-Agent string for Big Sur's Safari running on Apple Silicon (ARM) still says "Mac OS X 10_16" and, curiously, claims to be "Intel":

iPhoneX-test:/usr/local/bin root# apple80211
apple80211 interface_name [-qvh] -cmd[=new_val]
-q: Quiet mode. Produce script-friendly output.
-h: Verbose help.
-v: Verbose output.
-40int=[true/false] Get/Set 40 MHz intolerance.
-2g_chain_disable=[0/1,0/1] Get/Set 2Ghz shared chain disable and reassoc. [disabled,reassoc]
-acl_add=[mac addr,] Comma separated list of mac addresses to add to ACL list for the interface
-acl_flush Remove all entries from the ACL list for the interface
-acl_list List entries in the ACL list for the interface