Skip to content

Instantly share code, notes, and snippets.

@LeZuse
LeZuse / 00_README.md
Last active April 22, 2024 15:06
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@skyzyx
skyzyx / homebrew-gnubin.md
Last active April 24, 2024 00:04
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@huilapman
huilapman / mac_osx_packet_filter.md
Created April 28, 2018 06:02
Mac OSX Packet Filter

Mac OSX 內建防火牆 PF 使用筆記]

你知道 Mac 本身也有內建防火牆嗎?
我指的不是 System Preferences 裡面有的防火牆(那個屬於 Application Firewall 指定程式進出的),而是可以像 linux iptables 可以設定規則的防火牆。

它叫做 Packet filter 簡稱 PF,因為 Mac OSX 屬於 BSD 系列的系統
自從 10.7 (Lion) 之後就有內建 PF(在這之前是 IPFW),只是預設是關閉的。

官方文件寫的非常少,大部分要參考 FreeBSD 的文件或者 OpenBSD 的文件,
大部分這二者看到的文件跟語法大多都支援。

@rao-abdul-mannan
rao-abdul-mannan / Spark2.2_CDH5.13_Jupyterhub
Last active March 30, 2021 07:28
This gist explains how to connect jupyterhub with Spark2 on CDH 5.13 Cluster
### This gist explains how to connect jupyterhub with Spark2 on CDH 5.13 Cluster.
Following below instructions, Spark can be configured with Jupyterhub on any cluster, standalone or locally etc
- Install jupyterhub by following instructions on official repo https://github.com/jupyterhub/jupyterhub
- Once installed, before configuring spark2 kernel first locate the jupyter's kernels directory.
On centos7, its under /usr/share/jupyter/kernels/
- Assuming all jupyterhub kernel's are in /usr/share/jupyter/kernels/
mkdir /usr/share/jupyter/kernels/pyspark2
- Create pyspark2 kernel
touch /usr/share/jupyter/kernels/pyspark2/kernel.json
@omoindrot
omoindrot / tensorflow_finetune.py
Last active February 25, 2024 15:00
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
module BoolLike where
import Prelude hiding ((&&), (||), not)
import qualified Prelude as P
@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active May 17, 2024 09:02
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@jgornick
jgornick / docker-cleanup.sh
Created May 20, 2016 19:07
Docker: Cleanup (Remove all exited containers and dangling images)
#!/bin/bash
docker rm $(docker ps -q -f status=exited)
docker rmi $(docker images -q -f dangling=true)
@paf31
paf31 / node-haskell.md
Last active May 14, 2024 03:51
Reimplementing a NodeJS Service in Haskell

Introduction

At DICOM Grid, we recently made the decision to use Haskell for some of our newer projects, mostly small, independent web services. This isn't the first time I've had the opportunity to use Haskell at work - I had previously used Haskell to write tools to automate some processes like generation of documentation for TypeScript code - but this is the first time we will be deploying Haskell code into production.

Over the past few months, I have been working on two Haskell services:

  • A reimplementation of an existing socket.io service, previously written for NodeJS using TypeScript.
  • A new service, which would interact with third-party components using standard data formats from the medical industry.

I will write here mostly about the first project, since it is a self-contained project which provides a good example of the power of Haskell. Moreover, the proces

@staltz
staltz / introrx.md
Last active May 22, 2024 13:59
The introduction to Reactive Programming you've been missing