Skip to content

Instantly share code, notes, and snippets.

View rdnvndr's full-sized avatar

Andrey Rodionov rdnvndr

View GitHub Profile
@bzerangue
bzerangue / recursively-rename-extension.sh
Created April 16, 2012 00:31
Terminal Script: Recursively rename or change file extensions (this example, changing extension from .html to .php)
find . -name "*.html" | while read i; do mv "$i" "${i%.html}.php"; done
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@vitorbritto
vitorbritto / regex.md
Last active September 27, 2025 02:41
Regex Cheat Sheet

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
@martylouis
martylouis / markdown-cheatsheet.md
Created August 7, 2014 19:46
Markdown Cheatsheet

Sample Markdown Cheat Sheet

This is a sample markdown file to help you write Markdown quickly :)

If you use the fabulous [Sublime Text 2/3 editor][ST] along with the [Markdown Preview plugin][MarkdownPreview], open your ST2 Palette with CMD+⇧+P then choose Markdown Preview in browser to see the result in your browser.

Text basics

this is italic and this is bold . another italic and another bold

@Youka
Youka / lua_myobject.cpp
Last active August 27, 2024 06:32
Example of Lua in C++ and userdata objects
// Lua C API
#include <lua.hpp>
// C++ input/output streams
#include <iostream>
// MyObject as C++ class
class MyObject{
private:
double x;
public:
@rkmax
rkmax / enable-remote.sh
Created November 18, 2014 23:50
Setup a virtual screen for connect from VNC viewer (example VNC VIwer Android)
#!/bin/bash
WIDTH=1280
HEIGHT=800
x11_cmd=x11vnc
if [[ ! -z $(pgrep ${x11_cmd}) ]]; then
pkill ${x11_cmd}
fi
@Temptationx
Temptationx / disconnect.c++
Last active March 14, 2019 19:20
C++ lambda Qt disconnect
auto conn = std::make_shared<QMetaObject::Connection>();
*conn = QObject::connect(obj, &Object::signal, this, [this, conn]() {
disconnect(*conn);
});
@adam-p
adam-p / Local PR test and merge.md
Last active September 18, 2025 16:14
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@ezekg
ezekg / regex.md
Created September 25, 2015 19:09
Regex

The following should be escaped if you are trying to match that character

\ ^ . $ | ( ) [ ]
* + ? { } ,

Special Character Definitions

  • \ Quote the next metacharacter
  • ^ Match the beginning of the line
@chris-pilcher
chris-pilcher / TFSCommandLineMac.md
Last active August 17, 2023 09:52
Using TFS Online TFVC with command-line TFS utility on Mac

Install Command-Line TFS using HomeBrew on a Mac

Install Team Explorer Everywhere Command Line Client

  • Press Command+Space and type Terminal and press enter/return key.
  • Install HomeBrew by running command in Terminal app
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
  • Run: