Skip to content

Instantly share code, notes, and snippets.

@b0gdanw
b0gdanw / Disable-Ventura-Bloatware.sh
Last active October 18, 2024 02:02
Disable Ventura Bloatware
#!/bin/zsh
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12) and macOS Ventura (13)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Jigsaw puzzle</title>
<script type="text/javascript">
function save(filename, data)
{
var blob = new Blob([data], {type: "text/csv"});
@yi
yi / gist:01e3ab762838d567e65d
Created July 24, 2014 18:52
lua hex <= => string
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active October 9, 2024 11:32
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@uhziel
uhziel / AngleToValid.c
Created September 6, 2012 08:23
将任意角度转化到 [0度,360度)。
float AngleToValid( float fAngle )
{
return fAngle - (int)floorf(fAngle / 360.0f) * 360;
}
@uhziel
uhziel / unameh.sh
Created September 6, 2012 05:08
human version of uname
unameh()
{
echo "kernel-name: $(uname --kernel-name)"
echo "nodename: $(uname --nodename)"
echo "kernel-release: $(uname --kernel-release)"
echo "kernel-version: $(uname --kernel-version)"
echo "machine: $(uname --machine)"
echo "processor: $(uname --processor)"
echo "hardware-platform: $(uname --hardware-platform)"
echo "operating-system: $(uname --operating-system)"
@uhziel
uhziel / run_PAGENT.bat
Created April 23, 2012 02:23
run PAGENT.exe and autoload all .ppk file in the current directory.
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
CALL:wi_run_pageant
GOTO:EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::
:: 工具函数
:::::::::::::::::::::::::::::::::::::::::::::::::::::
@uhziel
uhziel / output_all_colours.sh
Created April 22, 2012 13:01
a script that output all the colours to the screen. via http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
#include<time.h>
#include<stdio.h>
int main(void)
{
clock_t ticks1, ticks2;
ticks1=clock();
ticks2=ticks1;
while((ticks2-ticks1)/CLOCKS_PER_SEC<1) {
@uhziel
uhziel / time_t2calendartime.lua
Created March 26, 2012 03:47
convert time_t to calendar time in Lua
function time_t2calendartime(time)
return os.date("%Y-%m-%d %H:%M:%S", time)
end