Skip to content

Instantly share code, notes, and snippets.

View Samir55's full-sized avatar
💭
I may be slow to respond.

Ahmed Samir Abdelreheem Samir55

💭
I may be slow to respond.
View GitHub Profile
@ryanfb
ryanfb / blender_compress_mesh.py
Created May 21, 2020 12:48
Blender Python script for converting a mesh to GLB with Draco compression
# Blender Python script for converting a mesh to GLB with Draco compression.
# Tested on Blender 2.82
# Usage:
# blender --background --factory-startup --addons io_scene_gltf2 --python blender_compress_mesh.py -- -i #{source_path} -o #{out_path}
from os import path
from contextlib import redirect_stdout
from sys import argv
import argparse
import io
import bpy
@thomwolf
thomwolf / top-k-top-p.py
Last active January 2, 2024 07:43
Sample the next token from a probability distribution using top-k and/or nucleus (top-p) sampling
def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')):
""" Filter a distribution of logits using top-k and/or nucleus (top-p) filtering
Args:
logits: logits distribution shape (vocabulary size)
top_k >0: keep only top k tokens with highest probability (top-k filtering).
top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering).
Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751)
"""
assert logits.dim() == 1 # batch size 1 for now - could be updated for more but the code would be less clear
top_k = min(top_k, logits.size(-1)) # Safety check
@qinyao-he
qinyao-he / tensorrt.py
Last active June 19, 2020 08:28
Optimize frozen tensorflow graph using TensorRT
import os
import tensorflow as tf
import tensorflow.contrib.tensorrt as trt
def get_frozen_graph(graph_file):
"""Read Frozen Graph file from disk."""
with tf.gfile.FastGFile(graph_file, "rb") as f:
graph_def = tf.GraphDef()
@digiter
digiter / FixCommandForMacKeyboard.md
Last active December 2, 2022 19:48
Map Command Key to Control For ubuntu + mac keyboard

For each machine running xmodmap will give you the mapping and keycode, take a look first then write the script. I use ubuntu and mac keyboard. The below maps both left and right control and super.

Create an .Xmodmap file in your Linux home directory, with the following contents, then execute xmodmap .Xmodmap

clear control
clear mod4

keycode 37 = Super_L
keycode 105 = Super_R
@arbourd
arbourd / invert.md
Created May 9, 2017 23:12
Invert Windows 10 mouse scroll wheel
  1. Open Powershell as an administrator
  2. Run
    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
  3. Verify that all mice devices have had their FlipFlopWheel attributes set to 1
    Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0
  4. Reboot
@leesheppard
leesheppard / README.md
Last active July 28, 2022 16:09
Homebrew Formula patching old ImageMagick release 6.9.7-10

Install

brew install https://gist.githubusercontent.com/leesheppard/69a283ee4af484e2029809a0f5e09932/raw/88bc116b515a456a2e1bad476b6124d28ce2f6f6/imagemagick.rb

Pin this version

To prevent upgrades you can pin this version.

brew pin imagemagick
@EncodeTS
EncodeTS / keras VGG-Face Model.md
Last active February 19, 2024 06:56
VGG-Face model for keras

VGG-Face model for Keras

This is the Keras model of VGG-Face.

It has been obtained through the following method:

  • vgg-face-keras:directly convert the vgg-face matconvnet model to keras model
  • vgg-face-keras-fc:first convert vgg-face caffe model to mxnet model,and then convert it to keras model

Details about the network architecture can be found in the following paper:

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@lukas-h
lukas-h / license-badges.md
Last active April 21, 2024 09:35
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@baraldilorenzo
baraldilorenzo / readme.md
Created January 16, 2016 12:57
VGG-19 pre-trained model for Keras

##VGG19 model for Keras

This is the Keras model of the 19-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman