Skip to content

Instantly share code, notes, and snippets.

View nn1900's full-sized avatar

Eric Xu nn1900

  • China
  • 23:39 (UTC +08:00)
View GitHub Profile
@KaneCheshire
KaneCheshire / SimEnv_Xcode11.json
Created September 26, 2019 07:44
Output for the environment variables available on iOS simulators using `ProcessInfo.processInfo.environment`
{
"CA_ASSERT_MAIN_THREAD_TRANSACTIONS": "0",
"CA_DEBUG_TRANSACTIONS": "0",
"CFFIXED_USER_HOME": "/Users/kanecheshire/Library/Developer/XCTestDevices/2F7BBCEE-1020-4C33-9740-DCB7640911A4/data/Containers/Data/Application/4F2F5AA6-B639-45DE-9851-904569336CC4",
"CUPS_SERVER": "/private/tmp/com.apple.launchd.rz10bWAeQ8/Listeners",
"DYLD_FALLBACK_FRAMEWORK_PATH": ":",
"DYLD_FALLBACK_LIBRARY_PATH": "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib",
"DYLD_FRAMEWORK_PATH": "/Users/kanecheshire/Library/Developer/Xcode/DerivedData/Retryable-fezwrtdwmzupungrxeqznlnohxjl/Build/Products/Debug-iphonesimulator:/Users/kanecheshire/Library/Developer/Xcode/DerivedData/Retryable-fezwrtdwmzupungrxeqznlnohxjl/Build/Products/Debug-iphonesimulator",
"DYLD_LIBRARY_PATH": "/Users/kanecheshire/Library/Developer/Xcode/DerivedData/Retryable-fezwrtdwmzupungrxeqznlnohxjl/Build/Products/Debug-iphones
@afuggini
afuggini / defineProperty.js
Last active October 29, 2021 17:29
Object.defineProperty polyfill
/*!
* https://github.com/es-shims/es5-shim
* @license es5-shim Copyright 2009-2015 by contributors, MIT License
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE
*/
// vim: ts=4 sts=4 sw=4 expandtab
// Add semicolon to prevent IIFE from being passed as argument to concatenated code.
;
@BretFisher
BretFisher / pcat-install.sh
Last active April 15, 2025 04:14
On macOS: Install pygmentize and alias pcat for shell code syntax highlighting
# first install pygmentize to the mac OS X or macOS system with the built-in python
sudo easy_install Pygments
# then add alias to your ~/.bash_profile or ~/.bashrc or ~/.zshrc etc.
alias pcat='pygmentize -f terminal256 -O style=native -g'
@clemlatz
clemlatz / self-signed-ssl-certificate.md
Last active January 3, 2025 23:24
Setup a self-signed SSL certificate with Nginx (server and browser)

1. Configure server: Nginx

Create the certificate:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Create a strong Diffie-Hellman group:

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
@johnnyman727
johnnyman727 / openwrt-sdk-osx-compile.md
Last active June 16, 2019 19:29
Steps for compiling the OpenWRT SDK on OSX
  1. Install dependencies: brew install sdl openssl gettext
  2. Add the bin folder of gettext to your path: export PATH=$PATH:/usr/local/Cellar/gettext/0.19.4/bin
  3. Go through steps 1-9 here
  4. git clone --recursive https://github.com/tessel/openwrt-tessel.git
  5. cd openwrt-tessel
  6. Replace openwrt/tools/mkimage/Makefile with the file included in this Gist of the similar name (an artifact of OSX being unable to link against SSL development headers). Make sure to change lines 35 and 36 with a valid link to the openssl library brew installed in the previous step, if necessary. I created it by combining this debugging suggestion which didn't work and this updated file on master which also didn't work on its own.
  7. make V=99
/Applications/Xcode.app/Contents/
import android.annotation.TargetApi;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.os.Build;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.File;
@d2s
d2s / installing-node-with-nvm.md
Last active April 24, 2025 18:50
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
@igrigorik
igrigorik / domtokenlist_feature_detection.js
Last active June 21, 2023 16:57 — forked from yoavweiss/domtokenlist_feature_detection.js
DOMTokenList supports() example for Preload
var DOMTokenListSupports = function(tokenList, token) {
if (!tokenList || !tokenList.supports) {
return;
}
try {
return tokenList.supports(token);
} catch (e) {
if (e instanceof TypeError) {
console.log("The DOMTokenList doesn't have a supported tokens list");
} else {
@kidpixo
kidpixo / jupyter_shortcuts.md
Last active March 2, 2025 04:15
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Warning This is SEVERELY outdated, the current jupyter version is > 6.X, please refer to your current jupyter notebook installation!

Disclaimer : I just copied those shortcuts from Jupyter Menú > Help > Keyboard Shortcuts, I didn't wrote them myself.

Check your current shortcuts in your Help, shortcuts coule have been modified by extensions or your past self.

Toc

Keyboard shortcuts

@denblackstache
denblackstache / itunes_silent.ps1
Created February 22, 2015 22:39
iTunes Silent Installer | Without Bloatware
# Set-ExecutionPolicy to RemoteSigned to start this script
# Checking out the 7z
if (-not (test-path "C:\Program Files\7-Zip\7z.exe")) {throw "C:\Program Files\7-Zip\7z.exe needed"}
set-alias sz "C:\Program Files\7-Zip\7z.exe"
$source = "./iTunes64Setup.exe"
$dest = "./iTunes64Setup"
# Unpack Bloatware