Skip to content

Instantly share code, notes, and snippets.

View mbacvanski's full-sized avatar
🛸

Marc Bacvanski mbacvanski

🛸
View GitHub Profile
@KyleOng
KyleOng / sparse_dataloader.py
Created April 8, 2021 06:59
Pytorch dataloader for sparse tensor
from typing import Union
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
from scipy.sparse import (random,
coo_matrix,
csr_matrix,
vstack)
from tqdm import tqdm
@sile
sile / multi_process_storage.py
Last active October 29, 2023 21:55
An Optuna storage that uses multiprocessing module for inter process communication
import copy
from datetime import datetime
import multiprocessing
from optuna import distributions # NOQA
from optuna.storages import base
from optuna.storages.base import DEFAULT_STUDY_NAME_PREFIX
from optuna import structs
from optuna import type_checking
@stardustxx
stardustxx / app.js
Last active January 7, 2023 22:09
Nodejs Firebase Storage Sample
const express = require('express');
const app = express();
const googleStorage = require('@google-cloud/storage');
const Multer = require('multer');
const storage = googleStorage({
projectId: "<Firebase Project ID",
keyFilename: "<path to service accounts prviate key JSON>"
});
@jessicard
jessicard / macarons.md
Last active February 3, 2023 03:53
Macarons!

Basic macaron shell recipe

  • This will make approximately 100 shells, or about 4 dozen cookies
  • When practicing, I generally half this recipe to only make 1 sheet of cookies
  • When making macarons, you will generally flavor the filling but not the shells
  • You want to make the macarons the day before the event. You will store them in the refrigerator over night, and then take them out a few hours before to come to room temperature. This is because macarons are best when "ripened", or allowed to sit for at least one night and have the filling seep into the shells a bit. Otherwise, straight out of the oven, they can be too crunchy or hard
  • Macarons shells freeze well! Filled macarons can also freeze well depending on the filling. Buttercream fillings freeze great. Put the cookies into an airtight container before freezing
  • Everyones baking temperature and baking time vary depending on their oven - you might have to experiment a bit!
  • _I always separate egg whites myself by cracking the egg, p
#!/usr/bin/env python3
# Author: Serg Kolo
# Date: Oct 3rd, 2016
# Description: Script for aligning the center of
# user's active window with the center of the monitor
# Tested on: Ubuntu 16.04
# Written for: http://askubuntu.com/q/832720/295286
from __future__ import print_function
import gi
@zeroseis
zeroseis / disable-auto-android-file-transfer.md
Created September 14, 2015 17:28
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.
@karpathy
karpathy / min-char-rnn.py
Last active May 22, 2024 08:28
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@miketoth
miketoth / turn-down.sh
Last active June 30, 2018 16:19
TURN DOWN FOR WHAT MAC ONLY SORRY
#!/bin/bash
VOL=$(osascript -e "output volume of (get volume settings)")
NEWVOL=0
while true
do
if (($VOL == $NEWVOL)); then
$(osascript -e "set volume output volume 100")
echo $(osascript -e "output volume of (get volume settings)")
@MrDys
MrDys / gist:3512455
Created August 29, 2012 13:26
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id:
<div class="modal" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs