Skip to content

Instantly share code, notes, and snippets.

View miracleyoo's full-sized avatar

Miracleyoo miracleyoo

  • University of California San Diego
  • San Diego, USA
  • 12:42 (UTC -07:00)
View GitHub Profile
@timdrichards
timdrichards / cheat_sheet.txt
Created January 26, 2021 14:32
GDB cheat sheet
GDB commands by function - simple guide
---------------------------------------
More important commands have a (*) by them.
Startup
% gdb -help print startup help, show switches
*% gdb object normal debug
*% gdb object core core debug (must specify core file)
%% gdb object pid attach to running process
% gdb use file command to load object
import numpy as np
import cv2
import face_alignment
# Initialize the chip resolution
chipSize = 300
chipCorners = np.float32([[0,0],
[chipSize,0],
[0,chipSize],
[chipSize,chipSize]])
@zalo
zalo / 3DHeadOrientation.py
Last active August 16, 2022 06:30
This is an example using Adrian Bulat's face_alignment library and Python to draw the head's basis vectors
import numpy as np
import cv2
import face_alignment
# Initialize the face alignment tracker
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, flip_input=True, device="cuda")
# Start the webcam capture, exit with 'q'
cap = cv2.VideoCapture(0)
while(not (cv2.waitKey(1) & 0xFF == ord('q'))):
@thinkycx
thinkycx / thinkycx-zsh.sh
Last active May 13, 2024 04:02
install zsh with one script ( Ubuntu/CentOS/macOS)
#!/bin/bash
# author: thinkycx
# date: 2018-04-30
# update: 2020-07-07
# 20230520 fix zsh-autosuggestions clone bug
# usage:
# curl -fsSL https://gist.githubusercontent.com/thinkycx/2e21c3572a8d1fde21aad07a58fcf940/raw/ -o zsh.sh && sudo bash zsh.sh
#
# install zsh for one script
# support ubuntu & centos & macOS
@machinaut
machinaut / gravity.py
Created February 9, 2018 19:40
mujoco-py - Change Model Parameters on the Fly
#!/usr/bin/env python
import time
import numpy as np
from mujoco_py import load_model_from_xml, MjSim, MjViewer
XML = '''
<mujoco>
<worldbody>
<geom name='floor' pos='0 0 0' size='5 5 .125' type='plane' condim='3'/>
@steven2358
steven2358 / ffmpeg.md
Last active June 18, 2024 13:07
FFmpeg cheat sheet
@kingspp
kingspp / logging.py
Created April 22, 2017 07:14
Python Comprehensive Logging using YAML Configuration
import os
import yaml
import logging.config
import logging
import coloredlogs
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'):
"""
| **@author:** Prathyush SP
| Logging Setup
@dusty-nv
dusty-nv / pytorch_jetson_install.sh
Last active October 21, 2021 01:28
Install procedure for pyTorch on NVIDIA Jetson TX1/TX2 with JetPack <= 3.2.1. For JetPack 4.2 and Xavier/Nano/TX2, see https://devtalk.nvidia.com/default/topic/1049071/jetson-nano/pytorch-for-jetson-nano/
#!/bin/bash
#
# EDIT: this script is outdated, please see https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available
#
sudo apt-get install python-pip
# upgrade pip
pip install -U pip
pip --version
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7)
@junian
junian / twitch-recorder.py
Last active March 26, 2024 12:31
Record Twitch Streams Automatically in Python
# This code is based on tutorial by slicktechies modified as needed to use oauth token from Twitch.
# You can read more details at: https://www.junian.net/2017/01/how-to-record-twitch-streams.html
# original code is from https://slicktechies.com/how-to-watchrecord-twitch-streams-using-livestreamer/
import requests
import os
import time
import json
import sys
import subprocess
@ricgu8086
ricgu8086 / xor_keras.py
Created September 16, 2016 19:27 — forked from cburgdorf/xor_keras.py
Comparing XOR between tensorflow and keras
import numpy as np
from keras.models import Sequential
from keras.layers.core import Activation, Dense
from keras.optimizers import SGD
X = np.array([[0,0],[0,1],[1,0],[1,1]], "float32")
y = np.array([[0],[1],[1],[0]], "float32")
model = Sequential()
model.add(Dense(2, input_dim=2, activation='sigmoid'))