Skip to content

Instantly share code, notes, and snippets.

@macton
macton / vim_tips.txt
Created February 10, 2013 22:07
Tips for vim
----------------------------------------------------------------------------------------------------------------
Find & Replace non-printable characters in vim
http://durgaprasad.wordpress.com/2007/09/25/find-replace-non-printable-characters-in-vim/
1) Find hexa value of that non-printable character. Move your cursor to that character and press ‘ga’.
2) In escape mode, execute this ‘:%s/\%x85/\r/gc’. In my case, hexadecimal value of that non-printable character is 85. I replaced that with ‘\r’.
----------------------------------------------------------------------------------------------------------------
@macton
macton / linux_tips.txt
Last active November 5, 2023 02:05
Random Linux tips
-------------------------------------------------------------------------------------------------------------
View process memory info
$ cat /proc/<process_id>/smaps
-------------------------------------------------------------------------------------------------------------
Overall memory info
http://stackoverflow.com/a/13754307
$ smem
-------------------------------------------------------------------------------------------------------------
@macton
macton / README.md
Created April 27, 2013 21:16 — forked from mbostock/.block

Run like so:

node gist-clone-all.js username

You'll want to replace "username" with your own username.

This script clones using the push URL, so you should probably be the owner of the gists. You could also use this to clone someone else's gists, but in that case you may wish to edit the code to use gist_pull_url instead.

@macton
macton / cpuid_features.c
Last active November 5, 2023 02:04
Print cpuid features
// This file: https://gist.github.com/macton/4dd5fec2113be284796e
// See: Intel Intrinsics Guide https://software.intel.com/sites/landingpage/IntrinsicsGuide/
// See: CPUID Explorer http://www.flounder.com/cpuid_explorer1.htm
// See: Playing with cpuid http://newbiz.github.io/cpp/2010/12/20/Playing-with-cpuid.html
// See: MSDN __cpuid, __cpuidex http://msdn.microsoft.com/en-us/library/hskdteyh.aspx
// See: Notes on MMX/SSE and a searchable table of intrinsics. http://www.taffysoft.com/pages/20120418-01.html
// See: AMD CPUID Specification http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/25481.pdf
#if defined(__GNUC__)
#include <stdint.h>
// Simple, readable style.css template
body {
font-family: "Georgia", "Verdana", "Lucida Grande", sans-serif;
margin: 20px auto;
width: 95%;
font-size: 70%;
line-height: 1.4;
}
Enabling SSH
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-6-using-ssh/enabling-ssh
Connecting to WPA2-Enterprise Wifi Network
https://raspberrypi.stackexchange.com/a/24670
How to Mount an External Hard Drive on the Raspberry Pi
https://www.modmypi.com/blog/how-to-mount-an-external-hard-drive-on-the-raspberry-pi-raspian
(chroot) Install common stuff
@macton
macton / Dockerfile
Last active November 5, 2023 02:07
Unity on CentOS 7 on WSL2
# syntax=docker/dockerfile:1
FROM centos:7 as stage-1
##
## Install unityhub, chromimum, visual studio code, dotnet, gcc10 (+dependencies)
##
RUN yum -y install centos-release-scl-rh
RUN yum -y install epel-release
RUN yum -y install http://www.nosuchhost.net/~cheese/fedora/packages/epel-7/x86_64/cheese-release-7-1.noarch.rpm