Skip to content

Instantly share code, notes, and snippets.

View guicho271828's full-sized avatar
🤣
Lemonodor fame is but a hack away!

Masataro Asai guicho271828

🤣
Lemonodor fame is but a hack away!
View GitHub Profile
@vadimkantorov
vadimkantorov / packbits.py
Last active August 30, 2024 02:35
Pack bool and other integer tensors into smaller bitwidth in PyTorch (e.g. save 8x memory on BoolTensors), inspired by np.packbits / np.unpackbits
# PyTorch bit packing inspired by np.packbits / np.unpackbits. Feature request: https://github.com/pytorch/pytorch/issues/32867
import math
import torch
def tensor_dim_slice(tensor, dim, dim_slice):
return tensor[(dim if dim >= 0 else dim + tensor.dim()) * (slice(None), ) + (dim_slice, )]
#@torch.jit.script
def packshape(shape, dim : int = -1, mask : int = 0b00000001, dtype = torch.uint8, pack = True):
@typokign
typokign / zoomsucks.md
Last active September 8, 2023 05:06
Zoom Sucks

Zoom Sucks

  • Zoom abuses the installer flow on MacOS to bypass permissions dialogs (source)
  • Zoom sends identifying device info to Facebook, even when users don't have a Facebook account (source) (fixed)
  • A bug in Zoom sent identifying information (including email addresses and profile pictures) of thousands of users to strangers (source)
  • Zoom claims that meetings are end-to-end encrypted in their white paper and marketing materials, but meetings are only encrypted in transit, and are available in plaintext to Zoom servers and employees. (source)
  • zoomAutenticationTool can be used to escalat
@masatoi
masatoi / cl-random-forest-workspace.lisp
Created February 16, 2019 11:08
cl-random-forest-workspace.lisp
;;; -*- coding:utf-8; mode:lisp -*-
(in-package :cl-random-forest)
;;; Small dataset ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defparameter *n-class* 4)
(defparameter *target*
(make-array 11 :element-type 'fixnum
@tunabrain
tunabrain / Range.hpp
Last active August 1, 2019 08:30
Python ranges in C++
#ifndef RANGE_HPP_
#define RANGE_HPP_
template<typename T> class RangeIterator;
template<typename T>
class Range
{
T _start, _end, _step;
@nkt1546789
nkt1546789 / puclassifier.py
Last active May 12, 2022 15:13
Learning Classifiers from positive and unlabeled data by sample weighting proposed by Elkan and Noto 2008.
import numpy as np
from sklearn.linear_model import SGDClassifier
from sklearn.cross_validation import StratifiedKFold
from sklearn.grid_search import GridSearchCV
class PUClassifier(object):
def __init__(self, trad_clf=None, n_folds=2):
self.trad_clf = trad_clf
self.n_folds = n_folds
@nkt1546789
nkt1546789 / pu_demo.py
Last active June 19, 2019 15:41
A demo code for PU classification proposed by Elkan and Noto 2008
import numpy as np
import matplotlib.pyplot as plt
from numpy import random
import seaborn as sns
from sklearn import metrics
from puwrapper import PUWrapper
from sklearn.linear_model import LogisticRegression,LogisticRegressionCV
sns.set_style("white")
random.seed(0)
@fukamachi
fukamachi / common-lisp-scripting-with-roswell.md
Last active April 10, 2021 16:39
Common Lisp Scripting with Roswell (Draft)

Common Lisp Scripting with Roswell

"Roswell Script" is implementation-independent Common Lisp scripting program which uses Roswell. Although Roswell itself is a unified interface to Common Lisp implementations, it also encourages writing scripts with it.

To start writing it, run ros init in your terminal:

$ ros init
Usage: ros init [template] name [options...]
@burtonsamograd
burtonsamograd / save-lisp-tree-shake-and-die.lisp
Last active February 11, 2024 20:33
A quick and dirty tree shaker for SBCL, giving about a 40% reduction in dump size.
;; -*- mode: lisp -*-
;;
;; A quick and dirty tree shaker for SBCL. Basically, it destroys the
;; package system and does a gc before saving the lisp image. Gives
;; about a 40% reduction in image size on a basic hello world test.
;; Would like to hear how it works on larger projects.
;;
;; Original idea from: https://groups.google.com/d/msg/comp.lang.lisp/6zpZsWFFW18/WMy4PyA9B4kJ
;;
;; Burton Samograd
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
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