Skip to content

Instantly share code, notes, and snippets.

View ranjian0's full-sized avatar
🎯
Focusing

Ian Karanja ranjian0

🎯
Focusing
  • Nairobi, Kenya
  • 21:29 (UTC +03:00)
View GitHub Profile
@imaami
imaami / Makefile
Last active March 6, 2024 19:52
#template<>
override BIN := test
override SRC := test.c msg.c
override OBJ := $(SRC:%=%.o)
override DEP := $(SRC:%=%.d)
CFLAGS := -O2 -march=native -mtune=native -flto
$(BIN): $(OBJ)
$(CC) $(CFLAGS) -o $@ $^
@rodja
rodja / chat_app.py
Created May 8, 2023 03:36
Coding a Multi-User Chat App With NiceGUI
from uuid import uuid4
from nicegui import ui
messages = []
@ui.refreshable
def chat_messages(own_id):
for user_id, avatar, text in messages:
ui.chat_message(avatar=avatar, text=text, sent=user_id==own_id)
@Durman
Durman / Progress bar for blender.md
Created January 21, 2022 17:30
Examples of creating a progress bar in Blender

Showing progress bar in Blender

Main problem of showing progress bar in Blender UI is that while a script is running the UI is frozen. So the simplest (?) solution is to break execution whenever the progress status should be updated. For this you can use either timers or modal operators. The last one can't be switched on during all time of Blender execution and has some starting costs.

import bpy
from functools import partial
@Mluckydwyer
Mluckydwyer / opengl-in-wsl.md
Last active July 3, 2024 19:17
Install OpenGL on Ubuntu in WSL

How to Install OpenGL in Ubuntu in WSL2

These steps have been tested on Windows 10 with WSL2 running Ubuntu.

1. Dependencies

First install the dependencies:

apt install mesa-utils libglu1-mesa-dev freeglut3-dev mesa-common-dev

There are more than we need, but also include GLut and Glu libraries to link aginst during compilation for application development (these can be removed if that functionality is not required).

@Popov72
Popov72 / using_pix_with_canary.md
Last active June 29, 2024 20:18
Using PIX with Chrome

In PIX, Select Target Process => Launch Win32 and set the following 2 entries according to where Canary / Chrome is installed:

  • Path to executable: "C:\Users\alexis\AppData\Local\Google\Chrome SxS\Application\chrome.exe"
  • Working directory: "C:\Users\alexis\AppData\Local\Google\Chrome SxS\Application"
  • Command line arguments: --disable-gpu-sandbox --disable-direct-composition
    • You can add those arguments if you want to be able to see the disassembled shader code: --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming
  • Launch Suspended unchecked, Launch for GPU capture and Force D3D11On12 checked

Then click on "Launch".

Important: you should close all your Canary / Chrome windows/processes before clicking on the "Launch" button!

@CGLion
CGLion / blender_animated_verts_data.py
Last active April 29, 2023 06:04
Python for Blender - access mesh animated vertices location data
import bpy
import bmesh
obj = bpy.context.active_object
frames = range(0,10)
# get the object's evaluated dependency graph:
depgraph = bpy.context.evaluated_depsgraph_get()
# iterate animation frames:
for f in frames:
bpy.context.scene.frame_set(f)
# define new bmesh object:
@NickNaso
NickNaso / cpp.yml
Created June 3, 2020 23:55
Example of Github action for C++ rpoject
# This is a basic workflow to help you get started with Actions
# workflow - цепочка действий
# Имя процесса Билдится на всех типах 📦 🐍
name: CMake Build Matrix
# Controls when the action will run. Triggers the workflow on push
on:
push:
pull_request:
release:
@pauloapi
pauloapi / get_lambda_event_source.py
Last active October 10, 2022 17:08
AWS Lambda: Determine Event Source from event object. Based on this javascript gist https://gist.github.com/jeshan/52cb021fd20d871c56ad5ce6d2654d7b
def get_lambda_event_source(self, event: dict):
if 'pathParameters' in event and 'proxy' in event['pathParameters']:
return 'api_gateway_aws_proxy'
if 'requestContext' in event and 'resourceId' in event['requestContext']:
return 'api_gateway_http'
elif 'Records' in event and len(event['Records']) > 0 and 'eventSource' in event['Records'][0] and event['Records'][0]['eventSource'] == 'aws:s3':
return 's3'
elif 'Records' in event and len(event['Records']) > 0 and 'EventSource' in event['Records'][0] and event['Records'][0]['EventSource'] == 'aws:sns':
return 'sns'
@cristianadam
cristianadam / build_qmake.yml
Last active September 9, 2023 10:56
GitHub Actions Doxygen Qt Creator plugin QMake build matrix
name: QMake Build Matrix
on: [push]
env:
QT_VERSION: 5.14.0
QT_CREATOR_VERSION: 4.11.0
PLUGIN_PRO: doxygen.pro
PLUGIN_NAME: Doxygen
@madkoding
madkoding / install-docker-deepin.sh
Last active July 19, 2024 10:18
Install Docker-CE script for Deepin Linux
#!/bin/bash
echo "Starting Docker installation on Deepin Linux..."
# Define a mapping from Deepin version to Debian version
map_deepin_to_debian() {
if [ "$1" -lt 20 ]; then
echo "stretch"
elif [ "$1" -ge 20 ]; then
echo "buster"