Skip to content

Instantly share code, notes, and snippets.

@datar
datar / gist:70ccce623177a2b05717801ba4b7ab13
Created December 27, 2017 01:36 — forked from tobert/gist:8063382
Switching clock from TSC to HPET on Linux.
tobert@spaceghost /sys/devices/system/clocksource/clocksource0 $ cat /proc/cpuinfo |grep 'model name' |head -n 1
model name : Intel(R) Xeon(R) CPU E31270 @ 3.40GHz
tobert@spaceghost /sys/devices/system/clocksource/clocksource0 $ cat /proc/version
Linux version 3.11.4-gentoo (root@sysresccd) (gcc version 4.6.4 (Funtoo 4.6.4) ) #1 SMP Mon Oct 7 05:33:55
tobert@spaceghost /sys/devices/system/clocksource/clocksource0 $ cat available_clocksource
tsc hpet acpi_pm
tobert@spaceghost /sys/devices/system/clocksource/clocksource0 $ cat current_clocksource
tsc
tobert@spaceghost /sys/devices/system/clocksource/clocksource0 $ echo hpet |sudo tee current_clocksource
hpet
@datar
datar / C-states.md
Created April 14, 2017 22:48 — forked from wmealing/C-states.md
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

@datar
datar / install-gcc48-linuxbrew-centos6.md
Created March 24, 2017 17:27 — forked from stephenturner/install-gcc48-linuxbrew-centos6.md
Installing gcc 4.8 and Linuxbrew on CentOS 6

Installing gcc 4.8 and Linuxbrew on CentOS 6

The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. I'd like to use gcc 4.8+. Also, when trying to install Linuxbrew you run into a dependency loop where Homebrew's gcc depends on zlib, which depends on gcc. Here's how I solved the problem.

Note: Requires sudo privileges.

Resources:

@datar
datar / c11-w.sublime
Created July 11, 2016 04:48 — forked from qwo/c11-w.sublime
Sublime C++11 Build System File
//ignore being compatible with C++99 and other warnings
{
"cmd": ["clang++","-std=c++11", "-w", "-stdlib=libc++", "-Weverything", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
@datar
datar / osx_install.sh
Last active August 29, 2015 14:16 — forked from t-io/osx_install.sh
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"