Skip to content

Instantly share code, notes, and snippets.

View galiminus's full-sized avatar
🏠
Working from home

Victor galiminus

🏠
Working from home
View GitHub Profile
@galiminus
galiminus / vertex_color_to_seams.py
Created September 11, 2023 10:23
blender vertex color to seams
import bpy
import bmesh
# Assume triangulated mesh
object = bpy.context.object
bm = bmesh.from_edit_mesh(object.data)
bm.calc_loop_triangles()
bm.edges.ensure_lookup_table()
# frozen_string_literal: true
module GraphQL
module Relay
# A connection implementation to expose SQL collection objects.
# It works for:
# - `ActiveRecord::Relation`
# - `Sequel::Dataset`
class SmartRelationConnection < BaseConnection
def cursor_from_node(item)
item_index = paged_nodes.index(item)
import face_alignment
from skimage import io
from argparse import ArgumentParser
def process_image(args):
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)
input = io.imread(args.inp)
preds = fa.face_detector.detect_from_image(input)

Install the serverless framework

https://serverless.com/

npm install -g serverless

Assuming you created a project named lambda-training, two files will be created in the lambda-training/ directory. The serverless.yml file is a configuration file that is heavily documented. The other file is handler.py which contains your lambda handler.

#!/bin/bash
sudo apt-get remove --purge -y libavcodec58 libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libswscale5 libswresample3 libpostproc55 ffmpeg
sudo add-apt-repository -y ppa:graphics-drivers/ppa
sudo apt-update -y
#sudo apt-get install -y nvidia-driver-435 nvidia-settings
# apt-get install gcc
# wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run
# sudo sh cuda_10.1.243_418.87.00_linux.run
@galiminus
galiminus / smart_relation_connection.rb
Created October 24, 2019 10:14
Faster next page check for GraphQL-ruby
# frozen_string_literal: true
module GraphQL
module Relay
# A connection implementation to expose SQL collection objects.
# It works for:
# - `ActiveRecord::Relation`
# - `Sequel::Dataset`
class SmartRelationConnection < BaseConnection
def cursor_from_node(item)
item_index = paged_nodes.index(item)
#!/bin/bash
sudo apt-get remove --purge -y libavcodec58 libavdevice58 libavfilter7 libavformat58 libavresample4 libavutil56 libswscale5 libswresample3 libpostproc55 ffmpeg
sudo add-apt-repository -y ppa:graphics-drivers/ppa
sudo apt-update -y
sudo apt-get install -y nvidia-driver-435 nvidia-settings
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers && sudo make install && cd -
sudo apt-get install -y libcudart10.1 libcudnn7 libcudnn7-dev nvidia-cuda-dev nvidia-cuda-doc nvidia-cuda-gdb nvidia-cuda-toolkit yasm libssl1.1 libssl-dev libass9 libass-dev libfdk-aac-dev libfdk-aac1 libmp3lame-dev libmp3lame0 libopencore-amrnb0 libopencore-amrnb-dev libopencore-amrwb0 libopencore-amrwb-dev libopus-dev libopus0 libopusfile-dev libopusfile0 libpulse0 libpulse-dev libtheora0 libtheora-dev libspeex1 libspeex-dev libtwolame0 libtwolame-dev libvpx-dev libvpx5 libx265-165 libx265-dev libxcb1 libxcb1-dev libv4l-0 libv4l-dev libvorbis0a libvorbis-dev libx264-155 libx264-dev libxvidcor
@galiminus
galiminus / convert.rb
Created August 21, 2017 09:50
Convert videos
#!/usr/bin/env ruby
Dir.glob('./TINY*.mp4') do |video|
system("ffmpeg -i #{video} -vf scale=-1:720 -c:v libx264 -crf 23 -preset slow -c:a copy -strict -2 #{video.gsub(".mp4", "_720.mp4")}")
end
{
"ami": "ami-dvwa",
"commands": [
"sudo yum -y update",
"wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/5.5.19/xampp-linux-x64-5.5.19-0-installer.run -O /tmp/xampp.run",
"chmod 755 /tmp/xampp.run",
"sudo /tmp/xampp.run --mode unattended --disable-components xampp_developer_files",
"sudo /opt/lampp/lampp start",
"sudo ln -s /opt/lampp/lampp /etc/rc3.d/S99lampp",
"sudo ln -s /opt/lampp/lampp /etc/rc3.d/K01lampp",