Skip to content

Instantly share code, notes, and snippets.

Avatar
🤙
Always motivated

Vincent Lee euler0

🤙
Always motivated
View GitHub Profile
View gist:5904423
[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.
View gist:5885688
[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.
View gist:5882835
[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 Dec 25, 2015
OS X Cheet Sheets
View gist:4431640
# 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 Oct 14, 2015
Git Cheat Sheet
View gist:4285394
# 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 Mar 27, 2012
CMake macro for precompiled headers
View gist:2213792
# 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 Nov 23, 2011
N2657: Local and Unnamed Types as Template Arguments (C++11)
View gist:1388021
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
View gist:1347132
using namespace std;
list<int> my_list;
...
// Range-based for-loop (C++11)
for_each (int x : my_list) {
cout << x << endl;
}