Skip to content

Instantly share code, notes, and snippets.

@crawler
crawler / what_i_serialize.rb
Last active January 10, 2024 16:59
WHAT I SERIALIZE?
# frozen_string_literal: true
###############################################################################################
# WHAT I SERIALIZE? #
###############################################################################################
# This scrip can help you to find what object types you need to witelist after CVE-2022-32224 update
# AD: If you using StimulusJS then checkout my gem stimulus_tag_helper
# https://rubygems.org/gems/stimulus_tag_helper
# https://github.com/crawler/stimulus_tag_helper
@MarkDana
MarkDana / m1-max-numpy-setup.md
Last active October 28, 2023 11:42
Install NumPy on M1 Max

How to install numpy on M1 Max, with the most accelerated performance (Apple's vecLib)? Here's the answer as of Dec 6 2021.


Steps

I. Install miniforge

So that your Python is run natively on arm64, not translated via Rosseta.

  1. Download Miniforge3-MacOSX-arm64.sh, then
  2. Run the script, then open another shell
$ bash Miniforge3-MacOSX-arm64.sh
@mrdbourke
mrdbourke / m1-ml-setup.md
Created November 27, 2021 03:11
Setting up a data science and machine learning environment with TensorFlow on M1, M1 Pro, M1 Max.

How to setup a TensorFlow environment on M1, M1 Pro, M1 Max using Miniforge

You: have a new M1, M1 Pro, M1 Max machine and would like to get started doing machine learning and data science on it.

This page: goes through a list of steps to install package managers and common machine learning and data science packages (software) on your machine and make sure they run using sample code.

Steps

  1. Download and install Homebrew from https://brew.sh. Follow the steps it prompts you to go through after installed.
  2. Download Miniforge3 (Conda installer) for macOS arm64 chips (M1, M1 Pro, M1 Max).
@scottchu
scottchu / apple-m1-snorkel-tensorflow-jupyter-setup.sh
Last active January 1, 2022 22:11
Setting up snorkel+jupyter+tensorflow on M1
# updated 2021-11-21
# Create conda environment
conda create --name snorkel "python=3.9" -y
conda activate snorkel
# Install Additional Packages
conda install -y \
"numpy<1.20.0" \
"pandas==1.3.3" \
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active July 18, 2024 16:00
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@twalpole
twalpole / gist:52e4f833572086bee9900e09889852be
Last active August 25, 2020 19:25
concurrency_test.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'selenium-webdriver'
gem 'webdrivers'
gem 'capybara'
gem 'byebug'
gem 'puma'
end
@ColinLeverger
ColinLeverger / update-images.sh
Created December 8, 2016 11:36
Update all Docker images
docker images | grep -v REPOSITORY | awk '{print $1}' | xargs -L1 docker pull
@fadhlirahim
fadhlirahim / access_token_helper.rb
Created September 6, 2016 05:07
doorkeeper oauth token in rspec
# assumption
# model user exist
#
module AccessTokenHelper
APP_NAME = "app name".freeze
REDIRECT_URL = "https://host.name/oauth/callback".freeze
def token_scopes(scopes)
app = Doorkeeper::Application.create!(:name => "MyApp", :redirect_uri => REDIRECT_URL)
user = create(:user)
@antond
antond / PKGBUILD-bzr
Last active August 29, 2015 14:11 — forked from PedroHLC/PKGBUILD-bzr
# Maintainer: Maxime Gauduin <alucryd@gmail.com>
# Contributors: M0Rf30, faidoc, sh4nks, PedroHLC
pkgname=lightdm-pantheon-greeter-bzr
pkgver=r274
pkgrel=0
pkgdesc="LightDM greeter from the ElementaryOS team written in Vala "
arch=('i686' 'x86_64')
url="https://launchpad.net/pantheon-greeter"
@lucasdavila
lucasdavila / fixup.txt
Last active December 20, 2023 12:00
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf