Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ray RayPS

🏠
Working from home
View GitHub Profile
@RayPS
RayPS / convert-clipboard-image.py
Last active Mar 1, 2021
Converting image format in clipboard - macOS Python (Copied as PNG, Paste as JPG)
View convert-clipboard-image.py
from PIL import Image
import io
import pasteboard
pb = pasteboard.Pasteboard()
pb_image = pb.get_contents(pasteboard.TIFF)
if pb_image:
image = Image.open(io.BytesIO(pb_image))
if image.mode == 'RGBA':
image.load()
@RayPS
RayPS / rm-pasf.js
Last active Nov 6, 2022
Remove the annoying "People also search for" from Google Search result
View rm-pasf.js
// ==UserScript==
// @name Remove "People also search for"
// @description Remove "People also search for" on Google
// @namespace ray@rayps.com
// @version 0.1.1
// @author Ray
// @match https://*.google.com/search*
// @match https://*.google.com.hk/search*
// @icon https://www.google.com/s2/favicons?domain=google.com
// ==/UserScript==
@RayPS
RayPS / Proxmark3.md
Last active Dec 8, 2020
Proxmark3 Mac (homebrew) File .eml not found or locked
View Proxmark3.md

Before:

$ proxmark3 /dev/cu.usbmodem14401
$ hf mf eload /Users/ray/Downloads/my-dump-file.eml

File /Users/ray/Downloads/my-dump-file.eml.eml not found or locked

After:

$ cd ~/Downloads
@RayPS
RayPS / rayps.zsh-theme
Last active Jul 8, 2021
A zsh theme made for myself, please use with FiraCode font
View rayps.zsh-theme
# Author:
# rayps
# Updated at:
# 2021-07-08 21:05:54
# Font:
# FiraCode
# Expansions:
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
# List all ZSH_THEME_GIT_PROMPT_*:
# grep -o "ZSH_THEME_GIT_[A-Z_]\+" .oh-my-zsh/lib/git.zsh| sort | uniq
@RayPS
RayPS / modulate.swift
Last active Aug 22, 2019
Swift modulate CGFloat between two ranges.
View modulate.swift
extension CGFloat {
func modulate(from: [CGFloat], to: [CGFloat], limit: Bool) -> CGFloat {
let result = to[0] + (((self - from[0]) / (from[1] - from[0])) * (to[1] - to[0]))
return limit ? [[result, to.min()!].max()!, to.max()!].min()! : result
}
}
@RayPS
RayPS / kali-linux-macbook-air-wifi.md
Last active Aug 10, 2022
Fix Wi-Fi adapter for Kali linux on MacBook Air
View kali-linux-macbook-air-wifi.md

Fix Wi-Fi adapter for Kali linux on MacBook Air

http.kali.org/kali/pool/non-free/b/broadcom-sta/

Replace the *** with the matching version number downloaded from the link above

$ wget http://http.kali.org/kali/pool/non-free/b/broadcom-sta/broadcom-sta-dkms_[**********]_all.deb
@RayPS
RayPS / Allow-to-use-wireless-data.swift
Created Nov 21, 2017
Grant internet access before loading any data. Only for China Apple Devices.
View Allow-to-use-wireless-data.swift
override func viewDidLoad() {
super.viewDidLoad()
if let url = URL(string: "http://captive.apple.com/generate_204") {
URLSession.shared.dataTask(with: url).resume()
}
}
View Gradient-Mask.swift
let gradient = CAGradientLayer()
gradient.colors = [
UIColor.black.cgColor,
UIColor.black.cgColor,
UIColor.clear.cgColor
]
gradient.locations = [
0,
@RayPS
RayPS / Framer-InputLayer.coffee
Last active Sep 6, 2017
Simple Framer InputLayer Class
View Framer-InputLayer.coffee
class InputLayer extends Layer
constructor: (options={}) ->
options.html = "<input type='text' value=''>"
super options
@define "input",
get: ->
return @querySelector("input")
# Usage:
textField = new InputLayer
height: 40
View Framer-Layer-Stack.coffee
Array::stack = (spacing = 0) ->
for layer, index in this
layer.y = this[index-1]?.maxY
layer.y += spacing