Skip to content

Instantly share code, notes, and snippets.

View kergalym's full-sized avatar

Galym Kerimbekov kergalym

  • Kazakhstan
View GitHub Profile
@kergalym
kergalym / SessionSaver.jsm
Created October 1, 2018 16:44
firefox-61.0/browser/components/sessionstore/SessionSaver.jsm
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["SessionSaver"];
ChromeUtils.import("resource://gre/modules/Timer.jsm", this);
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
@kergalym
kergalym / player_archery.py
Created November 10, 2022 10:53
[Panda3D] Player Archery
import random
from direct.gui.OnscreenText import OnscreenText
from direct.task.TaskManagerGlobal import taskMgr
from panda3d.bullet import BulletRigidBodyNode, BulletBoxShape
from panda3d.core import BitMask32, NodePath, Vec3, TextNode, Point3
from Settings.Input.aim import Aim
class PlayerArchery:
@kergalym
kergalym / cloak_pinning_fragment.py
Last active October 1, 2022 16:49
Panda3D: Cloak Pinning Fragment Code
# Pin the cloak down
spine_bone = actor.expose_joint(None, 'modelRoot', 'Korlan:Spine2')
self.spine_bones[name] = spine_bone
pin = spine_bone.attach_new_node(BulletRigidBodyNode('pin'))
self.cloth_pins[name] = pin
# Position of the cloak get's shifted, fix it
pin.set_z(0)
@kergalym
kergalym / state_machine_fragment.py
Last active September 5, 2022 20:04
[Panda3D] Horse Mounting State
self.mount_sequence = {npc_name: Sequence()}
def enterHorseMount(self, actor, child, parent):
if actor and parent and child:
actor_name = actor.get_name()
if not self.mount_sequence[actor_name].is_playing():
# Our horse (un)mounting animations have been made with imperfect positions,
# so, I had to change child positions to get more satisfactory result
# with these animations in my game.
mounting_pos = Vec3(0.5, -0.15, -0.45)
@kergalym
kergalym / git-assistant.py
Last active August 27, 2022 11:13
git-assistant
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
from pathlib import Path
from sys import argv
from os import chdir
from os import path
from os.path import isdir, exists, isfile
from os import system as runcmd
@kergalym
kergalym / camera_collider.py
Last active August 23, 2022 08:59
Camera Collider class for Panda3D
from direct.interval.LerpInterval import LerpPosInterval
from direct.task.TaskManagerGlobal import taskMgr
from panda3d.bullet import BulletSphereShape, BulletGhostNode
from panda3d.core import BitMask32, Point3
class CameraCollider:
def __init__(self):
self.base = base
@kergalym
kergalym / backtrace
Created July 10, 2022 17:54
Panda3D Backtrace
Thread 1 "python3.9" received signal SIGSEGV, Segmentation fault.
0x00007fffee5ae550 in ?? () from /usr/lib64/libnvidia-glcore.so.470.103.01
(gdb) bt
#0 0x00007fffee5ae550 in () at /usr/lib64/libnvidia-glcore.so.470.103.01
#1 0x00007fffee6e0a87 in () at /usr/lib64/libnvidia-glcore.so.470.103.01
#2 0x00007fffee6e0ae9 in () at /usr/lib64/libnvidia-glcore.so.470.103.01
#3 0x00007fffee6e0ae9 in () at /usr/lib64/libnvidia-glcore.so.470.103.01
#4 0x00007fffee5e98c5 in () at /usr/lib64/libnvidia-glcore.so.470.103.01
#5 0x00007fffee5b3a3d in () at /usr/lib64/libnvidia-glcore.so.470.103.01
#6 0x00007fffee536521 in () at /usr/lib64/libnvidia-glcore.so.470.103.01
@kergalym
kergalym / player_camera.py
Last active July 1, 2022 21:28
[Panda3D] Third Person Camera Collision
from direct.interval.LerpInterval import LerpPosInterval
from direct.task.TaskManagerGlobal import taskMgr
from panda3d.bullet import BulletSphereShape, BulletGhostNode
from panda3d.core import BitMask32, Point3
class PlayerCamera:
def __init__(self):
self.base = base
@kergalym
kergalym / Inventory.py
Created June 22, 2022 11:14
Panda3D Inventory (original code)
# -*- coding: utf-8 -*-
from panda3d.core import *
from direct.gui.DirectGui import *
from direct.gui.OnscreenText import OnscreenText
import random
import sys
HIDDEN = 0
VISIBLE = 1
MIDDLE = 0
@kergalym
kergalym / encoding-video.md
Created May 10, 2022 19:08 — forked from Vestride/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus