Skip to content

Instantly share code, notes, and snippets.

View stilobique's full-sized avatar
🎮
Make Video Game... or not

Aurelien Vaillant stilobique

🎮
Make Video Game... or not
View GitHub Profile
@skriticos
skriticos / QTreeView.1.py
Last active August 29, 2024 18:23
Simple QTreeView example
#! /usr/bin/env python3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# In this prototype/example a QTreeView is created. Then it's populated with
# three containers and all containers are populated with three rows, each
# containing three columns.
# Then the last container is expanded and the last row is selected.
# The container items are spanned through the all columns.
# Note: this requires > python-3.2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import sys, os, pprint, time
@aaroncox
aaroncox / gist:5548105
Created May 9, 2013 15:16
Cloning a Repo from Github using Dulwich/Python
#!/usr/bin/env python
import dulwich.client
from dulwich.repo import Repo
from dulwich import index
import os
import shutil
client, path = dulwich.client.get_transport_and_path("https://github.com/aaroncox/d3.git")
@codeguy
codeguy / slugify.js
Created September 24, 2013 13:19
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@liantian-cn
liantian-cn / gist:70ecbc40a896c9be2512
Last active December 2, 2023 18:21
List Task Schedule by Python
"""
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383607(v=vs.85).aspx
"""
import win32com.client
scheduler = win32com.client.Dispatch("Schedule.Service")
# list user task only
# scheduler.Connect()
@gpocentek
gpocentek / gl-form.py
Created December 12, 2017 11:44
python-gitlab login/password auth using cookies
import re
import sys
import requests
import gitlab
URL = 'https://gitlab.com'
SIGN_IN_URL = 'https://gitlab.com/users/sign_in'
@ayamflow
ayamflow / rotate-uv.glsl
Created January 16, 2018 23:24
Rotate UV in GLSL
vec2 rotateUV(vec2 uv, float rotation)
{
float mid = 0.5;
return vec2(
cos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,
cos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid
);
}
vec2 rotateUV(vec2 uv, float rotation, vec2 mid)
@CGArtPython
CGArtPython / linking_objects_materials_scens_between_blend_files.py
Created March 12, 2023 08:57
Beginner Blender Python tutorial code for linking objects, materials, and scens from one .blend file into another (tutorial video: https://youtu.be/ZrN9w8SMFjo)
# extend Python's functionality to work with file paths
import pathlib
# give Python access to Blender's functionality
import bpy
def remove_libraries():
"""remove the linked blend files"""
bpy.data.batch_remove(bpy.data.libraries)