Skip to content

Instantly share code, notes, and snippets.

@asukakenji
asukakenji / go-os-arch.md
Last active Jul 7, 2020
Go (Golang) GOOS and GOARCH
View go-os-arch.md

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.8.3 darwin/amd64.

A list of valid GOOS values

(Bold = supported by go out of the box, ie. without the help of a C compiler, etc.)

  • android
  • darwin
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active Jul 7, 2020
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
View how-to-install-latest-gcc-on-ubuntu-lts.txt
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@sindbach
sindbach / mongodb_lookup.go
Created Apr 15, 2016
A simple example of how to use $lookup in Golang using mgo.
View mongodb_lookup.go
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
func main() {
session, err := mgo.Dial("localhost")
if err != nil {
@phemmer
phemmer / main.go
Created Sep 23, 2015
xml rsa private key to pem converter in golang
View main.go
/*
Usage: go run main.go < /path/to/private-key.xml
Optionally takes base64 encoded input.
This is a very crude implementation. Any errors result in a panic.
*/
package main
import (
@oleksiiBobko
oleksiiBobko / tcp_server.c
Last active Jul 6, 2020
Simple socket server in C using threads (pthread library) Compiles on linux
View tcp_server.c
/*
C socket server example, handles multiple clients using threads
Compile
gcc server.c -lpthread -o server
*/
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
@passsy
passsy / ArrayAdapter.java
Last active Apr 21, 2020
ArrayAdapter for RecyclerView
View ArrayAdapter.java
package com.pascalwelsch.utils;
import android.support.annotation.Nullable;
import android.support.v7.util.DiffUtil;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@congjf
congjf / .Title
Last active May 22, 2020 — forked from border/mgoExample.go
Using MongoDB in golang with mgo
View .Title
Using MongoDB in golang with mgo
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application android:label="@string/app_name">
@andelf
andelf / sighup.go
Created Jun 29, 2013
golang process SIGHUP, HUP signal to reload configuration
View sighup.go
// program
package main
import "os/signal"
import "os"
import "fmt"
import "syscall"
import "time"
@granoeste
granoeste / EachDirectoryPath.md
Last active Jul 9, 2020
[Android] How to get the each directory path.
View EachDirectoryPath.md

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

You can’t perform that action at this time.