Skip to content

Instantly share code, notes, and snippets.

View RodgerOliver's full-sized avatar

Rodger Oliver Bittencourt RodgerOliver

View GitHub Profile
@kkoomen
kkoomen / vim_command_php_convert_array_syntax.md
Last active August 17, 2019 16:05
Vim command to convert PHP syntax array() to []

Vim

Add the following to your .vimrc:

function s:PHPConvertArrays() abort
  let l:winview = winsaveview()
  while search('\m\(\w\)\@<!\carray\s*(') > 0
    call execute("normal! dt(%r]\<C-O>r[")
 endwhile
@kkoomen
kkoomen / vim-auto-plug-upgrade-every-week.md
Last active July 30, 2023 05:47
Vim-Plug: Run PlugUpdate every week automatically

This snippet will check every time you run Vim whether it updated all your Plug packages for you. It will do this once a week automatically for you.

Add the following to your .vimrc:

function! OnVimEnter() abort
  " Run PlugUpdate every week automatically when entering Vim.
  if exists('g:plug_home')
    let l:filename = printf('%s/.vim_plug_update', g:plug_home)
 if !filereadable(l:filename)
@arnauldvm
arnauldvm / .gitconfig
Last active January 27, 2024 10:00
Git sync all local tracking branches with remotes
[alias]
tracking = "!f() { git for-each-ref --format '%(refname:short):%(upstream:short)' 'refs/heads' | egrep -v ':$'; }; f"
is-clean-workdir = "!f() { git diff --stat --exit-code || { echo \"Workdir dirty\"; exit 1; }; }; f"
is-clean-index = "!f() { git diff --stat --cached --exit-code || { echo \"Index dirty\"; exit 2; }; }; f"
is-clean = "!f() { git is-clean-workdir && git is-clean-index; }; f"
co-merge = "!f() { local=\"$1\"; remote=\"$2\"; git checkout \"$local\"; git merge --ff-only \"$remote\"; }; f"
current-branch = rev-parse --abbrev-ref HEAD
sync = "!f() { git is-clean || { echo Aborting sync.; exit 1; }; current=$(git current-branch); git fetch --all; git tracking | while IFS=: read local remote; do echo \"Merging $local with $remote\"; git co-merge \"$local\" \"$remote\"; done 3>&1 1>&2 2>&3 | egrep -i --color 'fatal|$' 3>&1 1>&2 2>&3; git checkout \"$current\"; }; f"
@mrf345
mrf345 / compton.conf
Last active December 10, 2019 09:55
compton config on archlinux nvidia drivers
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "glx";
@simonesestito
simonesestito / java.sh
Last active May 29, 2023 18:59
Termux script to run Java programs
#!/data/data/com.termux/files/usr/bin/bash
#
# HOW TO INSTALL
#
# Run this command in Termux:
#
# curl https://gist.githubusercontent.com/simonesestito/89bb66e6e08b8662a40fc42b822090e6/raw/setup.sh | bash
#
@dvlden
dvlden / ffmpeg.md
Last active July 7, 2024 17:09
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@noelboss
noelboss / git-deployment.md
Last active July 16, 2024 09:50
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@unbracketed
unbracketed / branch-fu.md
Created April 7, 2015 17:49
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@xero
xero / irc.md
Last active July 10, 2024 12:09
irc cheat sheet

IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
  • Leaves the specified channel.
@gitaarik
gitaarik / git_submodules.md
Last active July 16, 2024 09:42
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.