Skip to content

Instantly share code, notes, and snippets.

View euler0's full-sized avatar
🍎
Always motivated

Vincent Lee euler0

🍎
Always motivated
View GitHub Profile
[vincent@freebsd ~]$ sudo diskinfo -t /dev/ada0
ada0
512 # sectorsize
60022480896 # mediasize in bytes (55G)
117231408 # mediasize in sectors
0 # stripesize
0 # stripeoffset
116301 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.
[vincent@freebsd ~]$ sudo diskinfo -t /dev/ada1
/dev/ada1
512 # sectorsize
82348277760 # mediasize in bytes (76G)
160836480 # mediasize in sectors
0 # stripesize
0 # stripeoffset
159560 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.
[vincent@freebsd ~]$ sudo diskinfo -t /dev/ada1
/dev/ada1
512 # sectorsize
82348277760 # mediasize in bytes (76G)
160836480 # mediasize in sectors
0 # stripesize
0 # stripeoffset
159560 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.
@euler0
euler0 / gist:4431640
Last active November 17, 2023 07:28
OS X Cheet Sheets
# To default value
$ defaults delete com.apple.dock springboard-columns
# Arranging Launchpad (http://macnews.tistory.com/633)
$ defaults write com.apple.dock springboard-columns -int 7
$ defaults write com.apple.dock springboard-rows -int 9
$ killall Dock
# Reset Launchpad
$ rm ~/Library/Application\ Support/Dock/*.db
@euler0
euler0 / gist:4285394
Last active October 14, 2015 01:17
Git Cheat Sheet
# Delete a remote branch (or a tag)
$ git push origin --delete branch
# Or a syntactic sugar
$ git push origin :branch
# Delete a remote-tracking branch
$ git branch -r -d origin/branch
# Squash the last 4 commits
@euler0
euler0 / gist:2213792
Created March 27, 2012 07:47
CMake macro for precompiled headers
# Source: http://stackoverflow.com/questions/148570/using-pre-compiled-headers-with-cmake/2956392#2956392
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
IF(MSVC)
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
SET(PrecompiledBinary "$(IntDir)/${PrecompiledBasename}.pch")
SET(Sources ${${SourcesVar}})
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
@euler0
euler0 / gist:1388021
Created November 23, 2011 06:26
N2657: Local and Unnamed Types as Template Arguments (C++11)
template <class T> class X { };
template <class T> void f(T t) { }
struct {} unnamed_obj;
void f()
{
struct A { };
enum { e1 };
typedef struct {} B;
B b;
X<A> x1; // OK
using namespace std;
list<int> my_list;
...
// Range-based for-loop (C++11)
for_each (int x : my_list) {
cout << x << endl;
}