Skip to content

Instantly share code, notes, and snippets.

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

Rodrigo Reyes ByteDecoder

🏠
Working from home
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 18, 2024 18:28
Minimal APIs at a glance
@Tymski
Tymski / ScreenCaptureEditor.cs
Last active September 24, 2021 13:36
Unity make a screenshot from editor
using System.IO;
using UnityEditor;
using UnityEngine;
public class ScreenCaptureEditor : EditorWindow
{
private static string directory = "Screenshots/Capture/";
private static string latestScreenshotPath = "";
private bool initDone = false;
@pnhoang
pnhoang / howto-download-youtube-videos.md
Last active April 9, 2024 12:19
How to download ALL videos of ANY YouTube Channel
@Loriowar
Loriowar / sidekiq@.service
Last active May 14, 2023 13:02
Systemd unit for multiprocess sidekiq. Based on example unit from official sidekiq page on GitHub.
# https://github.com/mperham/sidekiq/blob/master/examples/systemd/sidekiq.service
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
@ThiagoBarradas
ThiagoBarradas / codeclimate-dotnet-send-code-coverage.sh
Last active August 11, 2023 20:10
CodeClimate - send dotnet code coverage
# Download codeclimate test reporter
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./codeclimate-test-reporter
chmod +x ./codeclimate-test-reporter
# Install dotnet tools to generate test report
dotnet tool install --global coverlet.console
dotnet add package coverlet.msbuild
# Start codeclimate process
./codeclimate-test-reporter before-build
@omardelarosa
omardelarosa / CreateTilesFromTileset.cs
Created February 20, 2019 04:11
Tilemap Importer - PyxelEdit to Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.Tilemaps;
using System.IO;
public class CreateTilesFromTileset : EditorWindow
{
int padding = 5;
int buttonHeight = 25;
@db0sch
db0sch / regenerate_credentials.md
Last active May 11, 2024 10:34
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@ByteDecoder
ByteDecoder / revert-a-commit.md
Created August 10, 2018 01:48 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@sj26
sj26 / sidekiq.service
Last active May 3, 2024 07:07 — forked from dsadaka/\lib\systemd\system\sidekiq-static.service
systemd unit files for multiple sidekiq workers
[Unit]
Description=Sidekiq workers
# start as many workers as you want here
Wants=sidekiq@1.service
Wants=sidekiq@2.service
# ...
[Service]
Type=oneshot
ExecStart=/bin/true
@palkan
palkan / Gemfile
Last active April 27, 2024 02:02
FactoryProf: profiler for your FactoryGirl
# if you want to render flamegraphs
gem "stackprof", require: false # required by flamegraph
gem "flamegraph", require: false