Skip to content

Instantly share code, notes, and snippets.

@MihailCosmin
MihailCosmin / cuda_11.8_installation_on_Ubuntu_22.04
Last active April 27, 2024 18:21 — forked from primus852/cuda_11.7_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
@mrblue12-byte
mrblue12-byte / download_as_video.py
Created April 27, 2024 18:19 — forked from yogeshsinghgit/download_as_video.py
Download YouTube Videos in Mp4 Format using Python Pytube module
from pytube import YouTube
def download_Video(yt):
# filter mp4 streams from object
my_streams = yt.streams.filter(file_extension='mp4',only_video=True)
for streams in my_streams:
# print itag, resolution and codec format of Mp4 streams
print(f"Video itag : {streams.itag} Resolution : {streams.resolution} VCodec : {streams.codecs[0]}")
@donpandix
donpandix / valida_rut.js
Last active April 27, 2024 18:20
Valida RUT chileno con JavaScript
var Fn = {
// Valida el rut con su cadena completa "XXXXXXXX-X"
validaRut : function (rutCompleto) {
if (!/^[0-9]+[-|‐]{1}[0-9kK]{1}$/.test( rutCompleto ))
return false;
var tmp = rutCompleto.split('-');
var digv = tmp[1];
var rut = tmp[0];
if ( digv == 'K' ) digv = 'k' ;
return (Fn.dv(rut) == digv );
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 27, 2024 18:19
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@wojteklu
wojteklu / clean_code.md
Last active April 27, 2024 18:18
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@todgru
todgru / starttmux.sh
Last active April 27, 2024 18:17
Start up tmux with custom windows, panes and applications running
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
@rafsuntaskin
rafsuntaskin / functions.php
Last active April 27, 2024 18:10
Alter WooCommerce CSV Export delimiter
<?php
add_filter( 'woocommerce_product_export_delimiter', function ( $delimiter ) {
// set your custom delimiter
$delimiter = '.';
return $delimiter;
} );
@daniel-ilett
daniel-ilett / TriangleTexturePlugin.cs
Created April 27, 2024 17:48
A Unity editor script which takes a mesh and generates a texture based on the UVs where each triangle is assigned a random greyscale color (place the script inside a folder named Editor).
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor;
using UnityEditor.UIElements;
// Based on: https://forum.unity.com/threads/save-rendertexture-or-texture2d-as-image-file-utility.1325130/
public class TriangleTexturePluginWindow : EditorWindow
@Strus
Strus / clangd.md
Last active April 27, 2024 18:08
How to use clangd C/C++ LSP in any project

How to use clangd C/C++ LSP in any project

tl;dr: If you want to just know the method, skip to How to section

Clangd is a state-of-the-art C/C++ LSP that can be used in every popular text editors like Neovim, Emacs or VS Code. Even CLion uses clangd under the hood. Unfortunately, clangd requires compile_commands.json to work, and the only way to painlessly generate it is to use CMake.

But what if I tell you you can quickly hack your way around that, and generate compile_commands.json for any project, no matter how compilcated? I have used that way at work for years, originaly because I used CLion which supported only CMake projects - but now I use that method succesfully with clangd and Neovim.

Method summary

Basically what we need to achieve is to create a CMake file that will generate a compile_commands.json file with information about: