Skip to content

Instantly share code, notes, and snippets.

refactor

Block or report user

Report or block refactor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@refactor
refactor / xmerl_test.erl
Last active Jan 21, 2019
try to modify xml, add some element node
View xmerl_test.erl
-include_lib("xmerl/include/xmerl.hrl").
%% tuple -> xml-erl
TL = {filemeta,[{id,'/Foo'},{bar,12111111113}], [{name,["11"]},{age,["1"]}]}.
XmlDoc = xmerl:export_simple([TL], xmerl_xml).
%% xml-erl -> tuple
TL = xmerl_lib:simplify_element(XmlDoc).
@refactor
refactor / autowarp_test.c
Last active Jan 27, 2019
test GDALAutoCreateWarpedVRT
View autowarp_test.c
#include <cpl_conv.h>
#include <ogr_srs_api.h>
#include <gdalwarper.h>
/*
* https://www.gdal.org/warptut.html
*/
int main()
{
GDALAllRegister();
@refactor
refactor / osr_test.c
Last active Jan 20, 2019
GDAL's coordinate system demo
View osr_test.c
#include <ogr_srs_api.h>
#include <cpl_conv.h>
int main(void) {
OGRSpatialReferenceH sr = OSRNewSpatialReference(NULL);
OSRImportFromEPSG(sr, 3857);
// OSRSetWellKnownGeogCS(sr, "WGS84");
char* ppsz;
OSRExportToPrettyWkt(sr, &ppsz, FALSE);
printf("3857.wkt: \n%s\n", ppsz);
View Quirks of C.md

Here's a list of mildly interesting things about the C language that I learned over time. There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
       int x;
   } baz;
};
@refactor
refactor / cpuinfo
Created Aug 31, 2012
Intel(R) Core(TM)2 Quad CPU Q8300 @ 2.50GHz
View cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Quad CPU Q8300 @ 2.50GHz
stepping : 10
microcode : 0xa07
cpu MHz : 2493.898
cache size : 2048 KB
physical id : 0
@refactor
refactor / atom_4_core
Created Aug 31, 2012
Intel(R) Atom(TM) CPU N2800 @ 1.86GHz (8GB memory)
View atom_4_core
erl
Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4] [async-threads:0] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G)
1> erlang:system_info(cpu_topology).
[{processor,[{core,[{thread,{logical,0}},
{thread,{logical,1}}]},
{core,[{thread,{logical,2}},{thread,{logical,3}}]}]}]
You can’t perform that action at this time.