Skip to content

Instantly share code, notes, and snippets.

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

Qiangjun Ran ranqiangjun

🏠
Working from home
View GitHub Profile
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@emanuelez
emanuelez / git_speed.md
Last active September 25, 2024 11:24
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@harlanbarnes
harlanbarnes / using-ssh-proxycommand-bypass-filter.md
Last active December 12, 2018 05:21
Using SSH ProxyCommand to Bypass Filtering

Overview

If you are in a location that allows SSH but doesn't allow access to GitHub (I'm looking at you India), here's an easy way to get around it.

Prerequisites

  1. You need a shell account on a network that doesn't filter GitHub. Ideas for that:
    1. Pay but Cheap: A micro instance on EC2 http://aws.amazon.com/ec2/pricing/
    2. Free-ish: One of the free shell solutions http://shells.red-pill.eu/
  2. The shell account will need access to the netcat binary called nc http://nc110.sourceforge.net/
@AkshayKalose
AkshayKalose / ajax_example.info.yml
Last active November 23, 2022 13:40
Drupal 8 - Ajax Example
name: 'Ajax Example'
description: 'Just an Ajax Example'
core: 8.x
type: module
@bojanz
bojanz / extension-patterns.md
Last active January 14, 2023 16:59
Extension patterns: events, tagged services, plugins

This documentation is destined for drupal.org. Created first as a gist to make initial comments easier. Rewrites and clarifications welcome. Code samples are simplified for clarity. Perhaps a bit too much?

When talking about extensibility, there are several distinct use cases:

  1. Reacting to an action that has already happened.

The reaction can be anything; outputting a message, sending an email, modifying a related object, etc. Examples:

  • "A node has been saved"
  • "A product has been added to the cart".
@mrkpatchaa
mrkpatchaa / README.md
Last active October 21, 2024 16:46
Bulk delete github repos

Use this trick to bulk delete your old repos or old forks

(Inspired by https://medium.com/@icanhazedit/clean-up-unused-github-rpositories-c2549294ee45#.3hwv4nxv5)

  1. Open in a new tab all to-be-deleted github repositores (Use the mouse’s middle click or Ctrl + Click) https://github.com/username?tab=repositories

  2. Use one tab https://chrome.google.com/webstore/detail/onetab/chphlpgkkbolifaimnlloiipkdnihall to shorten them to a list.

  3. Save that list to some path

  4. The list should be in the form of “ur_username\repo_name” per line. Use regex search (Sublime text could help). Search for ' |.*' and replace by empty.

@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@fmfpereira
fmfpereira / gist:4186d4e40b09b2b49f2a4c91576be78c
Created December 18, 2017 18:02
Remove uuid, _core and default_config_hash from Drupal 8.x profile install config files.
sed -i "/^uuid:/d;/^_core:/d;/^ default_config_hash:/d" *
@DavMorr
DavMorr / sed-to-strip-uuid-from-yaml-config-files--osx.md
Last active March 5, 2024 13:23
Drupal 8 - use sed to strip uuid line from exported config files

[Drupal 8] use sed (on OSX) to strip the uuid line from exported config files being used for module default configuration; i.e. [module_name]/config/optional|install

NOTE: this can also by bypassed in the export by using Drupal Cnnsole and including the --remove-uuid flag. Also using the --remove-config-hash flag can help prevent additional headaches.

Ex: drupal config:export --directory=”[full-path-to-location]” --tar --remove-uuid --remove-config-hash

The UUID should never be included when using when using these exported config yaml files as the default configuration pagaged with a custom module. This is suppoedly not to be a thing in the exported yaml files at some point, but until then stripping the uuid line out is a manual process which can be a pain as there can be a lot of files.

To automate this, run the following sed command in the directory containing the yaml files:

All about database

Because you know I am all about database
database, database, but no trigger (4x)

I am about database, base, base

Yeah it ain't clear
This font is size 2