Skip to content

Instantly share code, notes, and snippets.

@abinchy
abinchy / cgo1.go
Created September 28, 2020 07:14 — forked from tejainece/cgo1.go
Examples of calling C code from Golang
package main
//#include<stdio.h>
//void inC() {
// printf("I am in C code now!\n");
//}
import "C"
import "fmt"
func main() {
@abinchy
abinchy / DataUsage.swift
Created November 8, 2019 04:27 — forked from n-studio/DataUsage.swift
Get data usage with swift
#include <ifaddrs.h>
// http://stackoverflow.com/questions/25626117/how-to-get-ip-address-in-swift
func getIFAddresses() -> [String] {
var addresses = [String]()
// Get list of all interfaces on the local machine:
var ifaddr : UnsafeMutablePointer<ifaddrs> = nil
if getifaddrs(&ifaddr) == 0 {