Skip to content

Instantly share code, notes, and snippets.

View xwang233's full-sized avatar
🐢
Premature optimization is the root of all evil

Wang, Xiao xwang233

🐢
Premature optimization is the root of all evil
View GitHub Profile
@gavinb
gavinb / nvcc_warnings.md
Last active February 21, 2024 00:39
How to disable specific warnings with nvcc

We were seeing the following unexpected warnings in our builds:

C:/BuildAgent/work/19dd4d6ddfbe72aa/SecretProject/vcpkg_installed/x64-windows/include\fmt/format.h(771): warning : base class dllexport/dllimport specification differs from that of the derived class
C:/BuildAgent/work/19dd4d6ddfbe72aa/SecretProject/vcpkg_installed/x64-windows/include\fmt/format.h(3268): warning : base class dllexport/dllimport specification differs from that of the derived class

We use spdlog and fmt all over the place and weren't seeing these warnings elsewhere. Strangely there were not the usual error/warning codes that the compiler emits.
Then I noticed why - these diagnostics were preceded by the module name:

SomeFilter.cu
import torch
import torch.nn as nn
import pandas as pd
import time
torch.backends.cudnn.deterministic = False
torch.backends.cudnn.benchmark = True
@steven2358
steven2358 / ffmpeg.md
Last active June 23, 2024 18:17
FFmpeg cheat sheet
@asroy
asroy / Debugging Mixed Python C++ code in Visual Studio Code
Last active August 25, 2022 17:43
Debugging Mixed Python/C++ code in Visual Studio Code
I've tested it on Fedora 23 and Ubuntu 16.04. I'm using gcc-5.3.1, python-3.4, VS Code-1.14.0
You can debug mixed Python/C++ in the same GUI. It also works for MPI applications. You can switch between the debuggers and corresponding call stacks.
1. Packages needed
1) Visual Studio Code
2) Extensions for VS Code:
"Python" from Don Jayamanne (I'm using 0.6.7)
This allows VS Code act as the front end to debug python.
This gives VS Code ability to attach to a python script that uses module "ptvsd".
@boverby
boverby / mqtt_esp8266wemos.ino
Created May 26, 2017 20:43
mqtt_esp8266wemos - simple mqtt sender and receiver for wemos d1 mini. mac address is part of topic.
/*
Simple wemos D1 mini MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to the provided access point using dhcp, using ssid and pswd
It connects to an MQTT server ( using mqtt_server ) then:
- publishes "connected"+uniqueID to the [root topic] ( using topic )
@cdiener
cdiener / asciinator.py
Last active January 5, 2023 17:24
Convert image to ascii art
import sys; from PIL import Image; import numpy as np
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit()
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4
img = Image.open(f)
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) )
img = np.sum( np.asarray( img.resize(S) ), axis=2)
@danharper
danharper / background.js
Last active June 29, 2024 19:32
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});