Skip to content

Instantly share code, notes, and snippets.

View starsea's full-sized avatar
💭
I may be slow to respond.

starsea

💭
I may be slow to respond.
  • Los Angeles
View GitHub Profile
@SKaplanOfficial
SKaplanOfficial / now-playing.js
Last active July 3, 2025 05:25
AppleScript and JXA scripts to get Now Playing info. Works on macOS 15.4+, including macOS 26 beta 1.
function run() {
const MediaRemote = $.NSBundle.bundleWithPath('/System/Library/PrivateFrameworks/MediaRemote.framework/');
MediaRemote.load
const MRNowPlayingRequest = $.NSClassFromString('MRNowPlayingRequest');
const appName = MRNowPlayingRequest.localNowPlayingPlayerPath.client.displayName;
const infoDict = MRNowPlayingRequest.localNowPlayingItem.nowPlayingInfo;
const title = infoDict.valueForKey('kMRMediaRemoteNowPlayingInfoTitle');
@huilapman
huilapman / mac_osx_packet_filter.md
Created April 28, 2018 06:02
Mac OSX Packet Filter

Mac OSX 內建防火牆 PF 使用筆記]

你知道 Mac 本身也有內建防火牆嗎?
我指的不是 System Preferences 裡面有的防火牆(那個屬於 Application Firewall 指定程式進出的),而是可以像 linux iptables 可以設定規則的防火牆。

它叫做 Packet filter 簡稱 PF,因為 Mac OSX 屬於 BSD 系列的系統
自從 10.7 (Lion) 之後就有內建 PF(在這之前是 IPFW),只是預設是關閉的。

官方文件寫的非常少,大部分要參考 FreeBSD 的文件或者 OpenBSD 的文件,
大部分這二者看到的文件跟語法大多都支援。

@andras-tim
andras-tim / README.md
Last active September 9, 2023 13:35
Set New Tab background in Google Chrome

Set New Tab background in Google Chrome

  1. Install new-tab-background.user.js UserScript into your Tampermonkey
  2. Edit the UserScript header
  • Set up top-level domain of your country (change .hu to your country's TLD)
  • Change the file:///full/path/of/background.jpg example background URL to your desired URL (if you want to use local resource - `file://`` you have to enable "Allow access to file URLs" right for Tampermonkey)

Check my toolchain what can download & set random wallpaper from Google Image search on Xfce4

@vodolaz095
vodolaz095 / NumberOfTheWeekInMonth.go
Created February 19, 2016 15:33
Get the number of the week in Golang
package main
import(
"fmt"
"time"
)
func NumberOfTheWeekInMonth(now time.Time) int {
beginningOfTheMonth := time.Date(now.Year(), now.Month(), 1, 1, 1, 1, 1, time.UTC)
_, thisWeek := now.ISOWeek()
@mackuba
mackuba / content_blocker_tips.md
Last active January 25, 2025 12:24
Tips for writing iOS content blockers - HelsinkiOS
  • read this first: https://www.webkit.org/blog/3476/content-blockers-first-look/
  • start by adding a new extension target to your iOS app of type “content blocker”
  • launch the app using the main target’s scheme + a call to SFContentBlockerManager.reloadContentBlockerWithIdentifier() with the extension’s id in application:didFinishLaunchingWithOptions: to auto-reload the blocker in development mode
  • if you don’t call reloadContentBlockerWithIdentifier() then you need to switch the blocker off and on again in the Safari settings (stop the app in Xcode if the switch is not moving)
  • use inspector from desktop Safari to inspect the Safari in the simulator in order to find specific things to block
  • things like periods in the url-filter regexp need to be escaped with double backslashes, e.g. facebook\\.net
  • if you use if-domain, it needs to be an array, even for one element
  • domain foo.com might not match www.foo.com even though I think it’s supposed to (UPDATE: They've changed it in one of
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 4, 2025 01:46
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

##PHP 5.4新特性##

掌握

  • traits
    trait的引入,可以扩展class的内容,使class在某种形式上实现了多重继承,更加灵活,trait不能被实例化 示例代码:

    <?php
    

trait Hello {

<?php
$tel_no = $_GET['hm'];
$c = $_GET['c']?$_GET['c']:0;
$c++;
?>
<!DOCTYPE html>
<html>
<head>
<title>迷你轰炸台 - 短信炸弹 - BETA!</title>
<?php
@jqlblue
jqlblue / php-5.5-install.sh
Created August 10, 2013 01:37
php 5.5 install guide
#!/bin/bash
PHP_VERSION="5.5.0"
yum -y install \
curl-devel.x86_64 \
libmcrypt-devel.x86_64 \
libxml2-devel.x86_64 \
libtool-ltdl-devel.x86_64 \
pcre-devel.x86_64 \
@barryvdh
barryvdh / _ide_helper.php
Last active December 16, 2024 10:25
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");