Skip to content

Instantly share code, notes, and snippets.

@dlazares
dlazares / cuda_11.8_installation_on_Ubuntu_22.04
Created April 9, 2024 22:09 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@dlazares
dlazares / ParallelRadixSort.metal
Created January 7, 2024 21:02 — forked from kieber-emmons/ParallelRadixSort.metal
This gist is for an article I wrote on Medium (https://medium.com/p/4f4590cfd5d3).
//
// ParallelRadixSort.metal
//
// Created by Matthew Kieber-Emmons on 08/29/22.
// Copyright © 2022 Matthew Kieber-Emmons. All rights reserved.
// This work is for educational purposes only and cannot be used without consent.
//
#include <metal_stdlib>
using namespace metal;
@dlazares
dlazares / jwtGenerator.js
Created November 17, 2022 23:56
Apple oauth token generator
const jwt = require('jsonwebtoken')
const fs = require('fs')
const appleId = 'com.your.service.id.here'
const keyId = 'XXXXXXXXXX' // 10 chars, your generated apple key id
const teamId = 'ZZZZZZZZZZ'
const privateKey = fs.readFileSync('YOUR-PATH-HERE.p8')
const secret = jwt.sign(
{
@dlazares
dlazares / check.ts
Created September 16, 2022 17:36
Moondao probability check.ts
// copied from https://etherscan.io/address/0xf44066d120ca92e7f070c8b895ca29738f48fe41#code
const NFTBlacklist = [
17, 24, 34, 41, 52, 69, 71, 74, 77, 98, 105, 127, 146, 153, 162, 166, 178,
198, 204, 214, 216, 255, 280, 283, 319, 332, 337, 339, 355, 358, 359, 361,
367, 369, 375, 377, 380, 389, 392, 398, 400, 409, 421, 432, 438, 451, 453,
459, 484, 487, 491, 497, 498, 501, 503, 507, 508, 520, 521, 547, 552, 559,
561, 563, 565, 566, 568, 575, 579, 589, 591, 595, 602, 607, 608, 614, 637,
657, 676, 679, 685, 687, 692, 693, 694, 701, 705, 713, 727, 741, 743, 745,
748, 754, 765, 770, 772, 777, 780, 784, 785, 786, 789, 790, 798, 806, 807,
811, 814, 822, 827, 828, 832, 835, 844, 852, 861, 866, 869, 873, 878, 882,
@dlazares
dlazares / example.tsx
Created August 24, 2022 05:50
Walletconnect React Native Modal that also works on iOS simulator
import {
Qrcode,
RenderQrcodeModalProps,
WalletService,
WalletServiceRow,
} from '@walletconnect/react-native-dapp';
<View >
<Text>Show QR code:</Text>
<Switch
@dlazares
dlazares / MoonDAOWinnerV2.sol
Last active September 16, 2022 17:29
Simpler version of MoonDAOWinner contract without remapping bugs :). Storage is more expensive but much easier to read and verify the winners.
// SPDX-License-Identifier: MIT
// An example of a consumer contract that relies on a subscription for funding.
pragma solidity ^0.8.6;
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MoonDAOWinnerV2 is Ownable, VRFConsumerBaseV2 {
@dlazares
dlazares / topics_to_ssv.py
Created January 22, 2018 21:28 — forked from garaemon/topics_to_ssv.py
a script to output the values of ros topics into a text file
#!/usr/bin/env python
import roslib
roslib.load_manifest("sensor_msgs")
roslib.load_manifest("message_filters")
roslib.load_manifest("rxtools")
import rospy
import rxtools
import rxtools.rosplot
import sys