Skip to content

Instantly share code, notes, and snippets.

View hugoprudente's full-sized avatar

Hugo Prudente hugoprudente

View GitHub Profile
@mattexdee
mattexdee / drawings-to-walls.js
Last active October 20, 2023 11:14 — forked from schultzcole/drawings-to-walls.js
A macro script to convert polygonal drawings to walls
let drawings = canvas.drawings.controlled;
drawings = drawings.map(drawing =>{
switch (drawing.data.type) {
case "f":
case "p": {
let { _id, points, rotation, x, y, width, height } = drawing.data;
return { id: _id, valid: true, points, rotation, x, y, width, height };
}
case "r": {
@inscapist
inscapist / instruction.md
Last active April 29, 2021 02:45
Podman Machine + Virtualbox + Mac OSX

Install virtualbox

brew cask install virtualbox

Install podman machine

curl -L https://github.com/boot2podman/machine/releases/download/v0.17/podman-machine.darwin-amd64 --output /usr/local/bin/podman-machine
sudo chmod +x /usr/local/bin/podman-machine

setuid/setgid/sticky Cheatsheet (Linux)

setuid (s) setgid (s) sticky (t)
Directory ignored New subfiles inherit group Only owner of subfile can (re)move it*
File Executes as file owner Executes as group ignored

Sticky bit can be set with chmod as the first of four digits, or using {+,-}s (for setuid/setgid) and {+,-}t (for sticky). For example, to enable setuid,

chmod u+s $FILE  # Add setuid to a file
chmod 4755 $FILE # Possible permissions of /bin/ping
@mosquito
mosquito / README.md
Last active May 21, 2025 19:56
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@cjbottaro
cjbottaro / overlay.sh
Last active November 13, 2018 15:06
Convert ECS Optimized AMI to use overlay/overlay2
set -e
# Stop the docker daemon
/etc/init.d/docker stop
# Configure ECS Agent
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html
# http://docs.aws.amazon.com/AmazonECS/latest/developerguide/automated_image_cleanup.html
cat > /etc/ecs/ecs.config << "EOF"
ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION=1h
@efrecon
efrecon / run.tpl
Last active May 29, 2025 11:26
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
@kawaz
kawaz / install_neovim_to_amazonlinux.sh
Last active March 30, 2025 11:14
install neovim to amazonlinux
#!/usr/bin/env bash
sudo yum groups install -y Development\ tools
sudo yum install -y cmake
sudo yum install -y python34-{devel,pip}
sudo pip-3.4 install neovim --upgrade
(
cd "$(mktemp -d)"
git clone https://github.com/neovim/neovim.git
cd neovim
make CMAKE_BUILD_TYPE=Release
### I assume you run the commands as root
gradle_version=2.6
wget -c http://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
unzip gradle-${gradle_version}-all.zip -d /opt
ln -s /opt/gradle-${gradle_version} /opt/gradle
printf "export GRADLE_HOME=/opt/gradle\nexport PATH=\$PATH:\$GRADLE_HOME/bin\n" > /etc/profile.d/gradle.sh
source /etc/profile.d/gradle.sh
# check installation
gradle -v
@nealtodd
nealtodd / decorator.py
Created April 25, 2012 13:15
Python profiling decorator
from cProfile import Profile
import pstats
def profile(sort_args=['cumulative'], print_args=[10]):
profiler = Profile()
def decorator(fn):
def inner(*args, **kwargs):
result = None