This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
"github.com/tidwall/pretty" | |
) | |
var prettyOpts = pretty.Options{ | |
Width: 80, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() | |
{ | |
int x = 1; | |
if (x > 0) { | |
std::cout << "x (" << x << ") is greater than zero\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// https://blog.kowalczyk.info/article/wOYk/advanced-command-execution-in-go-with-osexec.html | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"os/exec" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"runtime/debug" | |
"runtime/pprof" | |
"strconv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ffi = require('ffi'), | |
ref = require('ref'), | |
Struct = require('ref-struct'), | |
Library = require('./Library'), | |
Type = ref.Type, | |
NULL = ref.NULL, | |
isNull = ref.isNull; | |
var groups = ['libs', 'types', 'structs', 'callbacks', 'enums']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <bitset> | |
int main(int argc, char **argv) { | |
int a = 0b0101; | |
a |= 0b1101; | |
std::cout << "a = " << std::bitset<8>(a) << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // std::cout | |
#include <atomic> // std::atomic, std::memory_order_relaxed | |
#include <thread> // std::thread | |
std::atomic_int foo (0); | |
void set_foo(int x) { | |
foo.store(x); // set value atomically | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> // std::sort | |
#include <iostream> | |
#include <vector> // std::vector | |
using namespace std; | |
int main() | |
{ | |
vector<int> a{3, 8, 1, 5, -8, 33, 4}; | |
sort( a.begin(), a.end() ); | |
int const n = a.size(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <complex> | |
#include <iostream> | |
int main() | |
{ | |
using namespace std::literals::complex_literals; | |
std::complex<double> c = 2.0 + 1i; // {2.0, 1.} | |
std::complex<float> cf = 2.0f + 1if; // {2.0f, 1.f} | |
std::complex<long double> cl = 2.0L + 1il; // {2.0L, 1.L} |