Skip to content

Instantly share code, notes, and snippets.

View andfoy's full-sized avatar

Edgar Andrés Margffoy Tuay andfoy

View GitHub Profile
@yzh119
yzh119 / st-gumbel.py
Created January 12, 2018 12:25
ST-Gumbel-Softmax-Pytorch
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def sample_gumbel(shape, eps=1e-20):
U = torch.rand(shape).cuda()
return -Variable(torch.log(-torch.log(U + eps) + eps))
@jlgerber
jlgerber / CMakeLists.txt
Last active December 14, 2023 07:52
cmake - handling executable and library with same name
# Lets say we want to add a library and an executable, both with the same name.
# In this example, it is resman
add_library(resman ${src_cpps} ${src_hpps} )
target_link_libraries(resman ${Boost_LIBRARIES} ${LIBYAML} ${LIBFMT})
#
# Add resman executable
#
# We call the executable resman-bin
add_executable(resman-bin main.cpp )
@alexrqs
alexrqs / update-tags.md
Last active February 5, 2020 18:30
Update github tags with new commits
Create a branch with the tag
	git branch {tagname}-branch {tagname}
	git checkout {tagname}-branch
Include the fix manually if it's just a change ....
	git add .
	git ci -m "Fix included" # or cherry-pick the commit, whatever is easier
	git cherry-pick {num_commit}
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active March 11, 2024 16:13
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@guifromrio
guifromrio / compress-pdf-with-gs.md
Created August 30, 2013 14:39
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.