Skip to content

Instantly share code, notes, and snippets.

View jcbrinfo's full-sized avatar

Jean-Christophe Beaupré jcbrinfo

View GitHub Profile
@jcbrinfo
jcbrinfo / ttk-themes.md
Last active June 6, 2021 18:46
How to set the Ttk theme

How to set the theme of a Ttk application on Linux

Ttk applications like git-gui and gitk look ugly by default on Linux because the default Ttk tries to emulate Motif. Here is how to make them less ugly.

  1. Choose a Ttk theme. A partial list is provided by the official wiki of TCL.
  2. If the chosen a theme that is not built-in:
    1. If not already done, create a directory dedicated to Ttk themes. Example: mkdir ~/.local/share/tk-themes
    2. Put the theme’s directory (there should be a pkgIndex.tcl file at its root) in it. For example, if we want the Clearlooks theme, we copy the content of the themes/clearlooks directory of the “Ttk themes” project (see the link above) in ~/.local/share/tk-themes/clearlooks
    3. If not already done, add the line export TCLLIBPATH= (where `` is the path to the directory where you put your Ttk themes) to your ~/.profile file (or whatever the script that e
@jcbrinfo
jcbrinfo / sketchup-linux.md
Last active June 5, 2017 03:43
Setup SketchUp for Linux

https://appdb.winehq.org/objectManager.php?sClass=version&iId=34500&iTestingId=97268

  1. Use Wine 2.1-staging 64 bits.
  2. Install winetrick FontsSmoothRGB (or another FontsSmooth depending on the desired font smoothing algorithm).
  3. Set the Windows version to Windows 7.
  4. Make mfc140u.dll native and built-in.
  5. Install the MSI (extract from the EXE) in C:\Program Files\SketchUp\SketchUp 2017\
  6. Copy system32/mfc140u.dll and syswow64/mfc140u.dll from an original Windows copy.

Note: On a 64-bits platform, system32 is for 64-bits DLLs and syswow64 is for 32-bits DLLs. Microsoft’s weirdnesses impress me everyday.

@jcbrinfo
jcbrinfo / dirname.sh
Created June 2, 2017 14:31
`dirname` in POSIX SH
#! /bin/sh
# dirname <path>
#
# Strip the last path component.
#
# Apply the same transformation than `dirname(1)`, but end the resulting path
# with `/`, so it can be safely used inside a `"$(…)"`
#
# Edge cases
@jcbrinfo
jcbrinfo / what-changed
Created May 13, 2017 20:33
A thin wrapper over the Nit’s `./tests.sh` script that displays the changes since the last run.
#! /bin/bash
# A thin wrapper over the Nit’s `./tests.sh` script that displays the changes
# since the last run.
#
# Also, recompiles (except when `--no-make` is specified) the invoked engine
# before running the tests.
#
# Synopsis
# --------
@jcbrinfo
jcbrinfo / markdown-comment.md
Last active May 9, 2017 15:43
The universal Markdown comment syntax

The universal Markdown comment syntax

Before

[/]: / "Your comment here"

After

It exploit the “reference-style” link syntax (and workarounds various bugs) to make the egine fully ignore the comment line.

@jcbrinfo
jcbrinfo / infographie-ressources.md
Last active March 9, 2018 09:45
Ressources utiles pour l’infographie
@jcbrinfo
jcbrinfo / migrate-drive.md
Last active September 17, 2016 22:11
How to migrate drive content

How to migrate drive content

This procedure explain how to migrate the content of one internal drive to another (example: upgrading your hard disk for a SSD), without requiring more than one SATA port (so the procedure works on laptops).

Note: This procedure works well if using a MBR. On the other hand, GPTs are more complex so we can not just copy them as-is: we have to recreate the headers. This implies that with GPTs, some systems may become unbootable (until some setting are changed manually) because IDs have changed.

WARNING: Some steps might assume 512 octets sectors.

Requirements

  • A LiveCD/LiveDVD/LiveUSB of Linux with GParted, kpartx and all the necessary driver to manage the partitions present on the old drive.
  • An external drive with enough free space to hold a single file which size equals the capacity of the old internal drive. Note: A contiguous unallocated zone maybe used in place of a file, but it’s more complex and error-prone.
/* For use in Stylish. */
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("github.com") {
body, .markdown-body {
font-family: "Noto Sans", sans-serif;
}
}
@jcbrinfo
jcbrinfo / git-reauthor.sh
Created June 30, 2016 14:31
Re-author the head of the specified branches.
#! /bin/sh
# Re-author the head of the specified branches of `origin`.
working_branch="$(git symbolic-ref --short HEAD 2>/dev/null || git describe --tags --always 2>/dev/null)"
[ -n "$working_branch" ] || exit
git stash || exit
reset_status() {
git checkout "${working_branch}"
git stash pop
@jcbrinfo
jcbrinfo / List Gist Updates.md
Last active June 28, 2016 16:16
List Gist Updates

List Gist Updates

Example: ./whatsnew-gist '2 hours ago' < gist-urls.txt

Use with moderation: Rate limits for unauthenticated IP addresses are very low (60 requests per hour as of 2016-06-20).