Skip to content

Instantly share code, notes, and snippets.

@NeoCat
NeoCat / honeywell_set_temp.sh
Last active August 17, 2024 15:14
Set temperature of honeywell Wi-Fi thermostat by shell script
#!/bin/bash
# Usage: ./honeywell_settmp.sh [-c|-h|-o] [<temp(F)>|schedule]
# Example: ./honeywell_settmp.sh -h 72 # set HEAT: temp=72F
# ./honeywell_settmp.sh -c schedule # set COOL: follow shceduled temp
# ./honeywell_settmp.sh -o # turn system OFF
######## Settings ########
LOGIN="YOUR_MAIL_ADDRESS"
PASSWORD="YOUR_PASSWORD"
@bmfurtado
bmfurtado / cssh.applescript
Last active January 5, 2025 03:00
Create multiple SSH sessions in split panes on iTerm2 and enable key broadcasting.
Moved to: https://github.com/bmfurtado/iterm2-cssh
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active November 4, 2024 16:50
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@oshikryu
oshikryu / gist:5491584
Last active October 16, 2020 10:14
youtube parsing
function getYoutubeKey(linkText) {
// var linkText = $('#modal #vidEmbedKey').val();
var reYoutubeKey = /^[a-zA-Z0-9\-]{11}$/;
if (reYoutubeKey.test(linkText)) {
return linkText;
}
var reYoutubeUrl = /http\:\/\/www\.youtube\.com\/watch\?v=([\w-]{11})/;
var httpsreYoutubeUrl = /https\:\/\/www\.youtube\.com\/watch\?v=([\w-]{11})/;
@shawnbot
shawnbot / index.md
Last active August 23, 2023 10:18
Testing web pages with Xcode's iOS Simulator

Finding the Simulator

You can test with the iOS Simulator that comes with Xcode. Navigate to the Xcode app in the Finder, right click and select "Show Package Contents":

screen shot 2013-05-06 at 12 04 27 pm

Then navigate to Contents > Applications, and open the shortcut to "iPhone Simulator" (it may be called "iOS Simulator" depending on which version of Xcode you're running):

screen shot 2013-05-06 at 12 05 45 pm

@brandonpittman
brandonpittman / CD2DIR.applescript
Last active July 6, 2019 09:25
AppleScript to switch to the current Finder directory while navigating the command line. Run as a TextExpander snippet (set to "AppleScript") for maximum utility.
tell application "System Events"
tell process "Finder"
if window 1 exists then
tell application "Finder"
set thePath to get quoted form of POSIX path of (target of front Finder window as text)
return "cd " & thePath & return
end tell
else
display alert "Finder doesn't have a window open." as warning giving up after 2
end if
@rangercyh
rangercyh / print_lua_table.lua
Last active November 5, 2021 07:39
按照lua的table格式进行缩进打印lua的table,目前还不支持key为table,因为是自己还没想好,如果key是table的时候怎么打印出来比较优美
function print_lua_table (lua_table, indent)
indent = indent or 0
for k, v in pairs(lua_table) do
if type(k) == "string" then
k = string.format("%q", k)
end
local szSuffix = ""
if type(v) == "table" then
szSuffix = "{"
end
@eric-hu
eric-hu / Open iterm tab here
Last active March 11, 2022 02:45
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
@1999
1999 / procrastination_en.js
Last active February 2, 2019 11:32
Script samples for Control Freak extension
// Stop procrastination (a script for Control Freak extension)
// Paste this code into "Javascript" tab with a scope set to "All"
// @see https://chrome.google.com/webstore/detail/control-freak/jgnchehlaggacipokckdlbdemfeohdhc
var now = new Date();
if (now.getHours() >= 0 && now.getHours() < 6) {
var defaultOverflow = getComputedStyle(document.body).overflow || "visible";
document.body.style.overflow = "hidden";
var overlay = document.createElement("div");
overlay.style.background = "rgba(0, 0, 0, .85)";
@cmackay
cmackay / gist:5863257
Last active April 28, 2025 13:41
AppleScript to save and restore window position and sizes.
-- allSettings is a list of records containing {width:? height:? apps:{{name:? pos:? size:?},...}
-- for each display setup store the apps and their associated position and size
property allSettings : {}
-- create a variable for the current settings
set currentSettings to {}
display dialog "Restore or save window settings?" buttons {"Restore", "Save"} default button "Restore"
set dialogResult to result