[root@localhost ~]# mkdir /centos_chroot
[root@localhost ~]# mkdir -p /centos_chroot/var/lib/rpm
# Install Command-line tools as dependency for Homebrew | |
xcode-select --install # Sets the development directory path to /Library/Developer/CommandLineTools | |
# Install Homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# Install Mas (command-line interface for Mac App Store) | |
brew install mas | |
# Search for Xcode showing only the first 5 results | |
mas search xcode | head -5 |
For faster connection speed and more flexibility.
/Applications/Xcode.app/Contents/MacOS/Xcode
#!/bin/bash | |
# Sample usage is as follows; | |
# ./signapk myapp.apk debug.keystore android androiddebugkey | |
# | |
# param1, APK file: Calculator_debug.apk | |
# param2, keystore location: ~/.android/debug.keystore | |
# param3, key storepass: android | |
# param4, key alias: androiddebugkey | |
USER_HOME=$(eval echo ~${SUDO_USER}) |
Here's how to set up a Windows 10 virtual machine in KVM with PCI passthrough. The VM will have access to an NVIDIA graphics card while the host machine (running Debian Buster) uses Intel integrated graphics. This is mostly for my own reference so I don't forget how I did it.
In order to do hardware passthrough with KVM at all, you need to enable the Intel Vt-d virtualization extensions. Edit /etc/default/grub
and edit the GRUB_CMDLINE_LINUX_DEFAULT
line so that it reads like:
/* | |
For any 1<k<=64, let mask=(1<<k)-1. hash_64() is a bijection on [0,1<<k), which means | |
hash_64(x, mask)==hash_64(y, mask) if and only if x==y. hash_64i() is the inversion of | |
hash_64(): hash_64i(hash_64(x, mask), mask) == hash_64(hash_64i(x, mask), mask) == x. | |
*/ | |
// Thomas Wang's integer hash functions. See <https://gist.github.com/lh3/59882d6b96166dfc3d8d> for a snapshot. | |
uint64_t hash_64(uint64_t key, uint64_t mask) | |
{ | |
key = (~key + (key << 21)) & mask; // key = (key << 21) - key - 1; |
## Place this file in "/etc/sysctl.d/network-tuning.conf" and | |
## run "sysctl -p" to have the kernel pick the new settings up | |
# Avoid a smurf attack | |
net.ipv4.icmp_echo_ignore_broadcasts = 1 | |
# Turn on protection for bad icmp error messages | |
net.ipv4.icmp_ignore_bogus_error_responses = 1 | |
# Turn on syncookies for SYN flood attack protection |
pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql
Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql
-h is for host.
-p is for port.
-U is for username.
-d is for database.
This shows how to build a nontrivial program using Zig+Emscripten or C+Emscripten.
In both cases Emscripten is only used as a linker, that is the frontend is either zig
or clang
.
"Nontrivial" here means the program uses interesting Emscripten features: