Skip to content

Instantly share code, notes, and snippets.

@fengyuentau
fengyuentau / readme.md
Last active March 13, 2024 08:15
Enable X11 forward for ssh to load images from remote server on MacOS Mojave

Enable X11 forward to load images from remote server on MacOS Mojave

Steps

  1. Install Xquartz to get X11 support on MacOS. You can google Xquartz and download it from its official site, or install using HomeBrew.

    brew cask install xquartz
  2. Launch Xquartz. Go to Preference -> Security, click the box Allow connections from clients. NOTE: You have to lauch Xquartz with Allow connections from clients enable everytime you want to ssh to remote server with X11 forwarding support.

@dzvon
dzvon / usual-linux-command.sh
Last active November 16, 2020 02:46
usual linux command
# Generate a Random Password
generate_random () {
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
@cherti
cherti / alert.sh
Created December 9, 2016 13:47
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@nikic
nikic / bench.php
Last active November 2, 2023 22:49
Benchmark of call_user_func_array vs switch optimization vs argument unpacking syntax
<?php error_reporting(E_ALL);
function test() {}
$nIter = 1000000;
$argNums = [0, 1, 2, 3, 4, 5, 100];
$func = 'test';
foreach ($argNums as $argNum) {
@willurd
willurd / web-servers.md
Last active June 24, 2024 11:36
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000