Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
VBoxManage.exe modifyvm "macOS Catalina" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "macOS Catalina" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "macOS Catalina" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "macOS Catalina" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "macOS Catalina" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "macOS Catalina" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
@xbalaji
xbalaji / create-macos-vm.txt
Last active June 25, 2023 01:50
create-macos-vm
# create a volume, attach it, erase the disk, save the install app to it
hdiutil create -o macos/Catalina -size 10g -volname Catalina -layout SPUD -fs HFS+J
hdiutil attach macos/Catalina.dmg -noverify -mountpoint /Volumes/Catalina
DISKNUM=$(df -h /Volumes/Catalina | tail -1 | cut -c6-10)
diskutil eraseDisk JHFS+ Catalina ${DISKNUM}
# now install the macos on to the mounted volume
"/Applications/Install macOS Catalina.app/Contents/Resources/createinstallmedia" --volume /Volumes/Catalina/ --nointeraction
# convert to img
@statik
statik / convert-to-prores
Created April 7, 2020 19:06
convert video file to prores
#!/usr/bin/env bash
set -eo pipefail
USAGE='convert-to-prores inputfile [outputfile] [prores setting 1 to 5, default 3]'
DESCRIPTION='
Converts a video file to ProRes for playback on HyperDeck or NLE
The outputfile is optional, if not provided it will be based on the input file name
The profile switch takes an integer from -1 to 5 to match the ProRes profiles
@vijayarun
vijayarun / cyclic-rotation.markdown
Last active April 15, 2020 09:17
Cyclic Rotation

Cyclic Rotation - Array

An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7] (elements are shifted right by one index and 6 is moved to the first place).

The goal is to rotate array A K times; that is, each element of A will be shifted to the right K times.

Write a function:

function solution($A, $K);

@seppestas
seppestas / git-tricks.md
Last active March 23, 2020 13:01
Git tricks and tips

Git tricks

A place to store git tricks I use (and still forget sometimes).

Access branches using working trees

Sometimes it's usefull to access multiple branches of a git repository at the same time, e.g to compare different versions of CAD designs or to allow copying parts from one brach to the other. One way to do this is cloning the repository multiple times, but this typicaly takes a while. For copying things from text files like code a web based repository browser like gitweb or Github works fine, but this isn't always availible.

A more efficient method is using [git's work-tree command][git-worktree]. This allows to check out multiple versions of the same repository, using the same gitdir as the original repo, saving time and space. To do this:

@ajb413
ajb413 / deploy.js
Last active August 24, 2022 03:15
A Node.js script for deploying a smart contract to the locally hosted Ethereum instance.
const fs = require('fs');
const Web3 = require('web3');
const web3 = new Web3('http://localhost:8545');
const bytecode = fs.readFileSync('./build/FirstContract.bin');
const abi = JSON.parse(fs.readFileSync('./build/FirstContract.abi'));
(async function () {
const ganacheAccounts = await web3.eth.getAccounts();
const myWalletAddress = ganacheAccounts[0];
@ajb413
ajb413 / FirstContract.sol
Created February 5, 2020 22:10
A basic smart contract for Ethereum written in the Solidity programming language.
pragma solidity ^0.5.12;
contract FirstContract {
function getInteger() public pure returns (uint) {
return 123;
}
}
Error in user YAML: (<unknown>): mapping values are not allowed in this context at line 1 column 15
---
title: OSX-KVM: Cài đặt máy ảo OSX cho linux
tags: ['osx', 'kvm', 'linux']
status: draft
---
  1. Install QEMU

    • Ubuntu

    sudo apt-get install qemu uml-utilities virt-manager dmg2img git wget libguestfs-tools virt-viewer

@spencersalazar
spencersalazar / easeInOut.h
Created January 27, 2020 05:09
Generic easing function with tweakable power and midpoint.
/** Ease in/out function with settable power and midpoint.
Use p parameter to adjust speed at endpoints (cubic: p=3, quartic: p=4)
Midpoint is point at which speed is fastest and uneased.
@param t time or independent variable in range [0,1]. Input should be scaled to this range from whatever source range is expected.
@param p power, e.g. quadratic=2, cubic=3. Non-integral powers can be used to fine-tune the curve.
@param mid midpoint of curve, where it is "most linear".
@return output value in range [0,1]. Can be multiplied to scale to desired range.