Skip to content

Instantly share code, notes, and snippets.

@otamajakusi
otamajakusi / gist:3ee1403cddbf2abee91cb7a78e12342d
Created March 19, 2024 02:53
how to download a large file from google drive
1. launch google colab and mount drive
2. launch cloud instance (e.g. EC2)
3. upload ssh key to google drive
4. use scp on google colab:
scp -o StrictHostKeyChecking=no -i ~/.ssh/uploaded.pem large-file user@cloud-instance-ip-addr:
5. download large-file from the cloud instance to the local machine
@otamajakusi
otamajakusi / fizzbuzz.rb
Last active September 22, 2023 08:32
fizzbuzz ruby implementation inspired by https://gist.github.com/kazuho/3300555
fizz = _fizz = lambda do
fizz = lambda do
fizz = lambda do
fizz = _fizz
"Fizz"
end
""
end
""
end
@otamajakusi
otamajakusi / gist:ef693e5ee0eccce228aa31a37decec81
Created December 26, 2022 01:18
in case of NO_PUBKEY A4B469963BF863CC
sudo apt-key del A4B469963BF863CC
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
@otamajakusi
otamajakusi / dump_sign.c
Created November 3, 2022 06:38
dump signature generated by `openssl dgst -sign private.pem -sha256 myfile > signature.sig`
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
int usage(const char *cmd) {
fprintf(stderr, "Error: %s private.pem signature.sig\n", cmd);
return 1;
}
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -y \
sudo pyqt5-dev-tools python3-pip \
libffi-dev libssl-dev zlib1g-dev liblzma-dev tk-dev \
libbz2-dev libreadline-dev libsqlite3-dev libopencv-dev \
build-essential git vim wget
@otamajakusi
otamajakusi / Makefile
Last active July 2, 2022 01:07
rsa-mod-exp
SRC = rsa-mod-exp.c main.c
OBJ = $(SRC:%.c=%.o)
TARGET = rsa
CFLAGS += -DUSE_HOSTCC
$(TARGET): $(OBJ)
$(CC) -o $@ $^
%.o:%.c
$(CC) $(CFLAGS) -o $@ -c $<
@otamajakusi
otamajakusi / misc.sh
Created February 25, 2022 02:25
bash scripts
#!/bin/bash
################
function get_source(){
source <(echo xxx=yyy)
}
get_source
echo $xxx
@otamajakusi
otamajakusi / dictionary-changed-size-during-iteration.py
Created January 31, 2022 04:06
RuntimeError: dictionary changed size during iteration
from threading import Thread
from time import sleep
mydict = {}
def x():
while True:
# RuntimeError: dictionary changed size during iteration
for k in mydict.keys():
@otamajakusi
otamajakusi / Dockerfile
Last active October 30, 2021 05:36
dockerfile for pytorch
FROM nvcr.io/nvidia/l4t-base:r32.5.0
ENV DEBIAN_FRONTEND=noninteractive
# https://qengineering.eu/install-pytorch-on-jetson-nano.html
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3.8 python3.8-dev \
ninja-build git cmake clang build-essential \
libopenmpi-dev libomp-dev ccache \
libopenblas-dev libblas-dev libeigen3-dev \
@otamajakusi
otamajakusi / docker-compose.yml
Last active October 30, 2021 12:10
docker-compose.yml for pytorch
version: '3.4' # to use volumes type bind
x-volumes: &volumes
- type: bind
source: "${JETPACK_ROOT}/usr/lib/aarch64-linux-gnu/libnvinfer.so.8.0.1"
target: "/usr/lib/aarch64-linux-gnu/libnvinfer.so.8.0.1"
read_only: true
- type: bind
source: "${JETPACK_ROOT}/usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so.8.0.1"
target: "/usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so.8.0.1"
read_only: true