Skip to content

Instantly share code, notes, and snippets.

@zyxar
zyxar / exercise.tour.go
Last active October 31, 2024 22:30
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@granoeste
granoeste / EachDirectoryPath.md
Last active November 4, 2024 06:16
[Android] How to get the each directory path.

System directories

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

External storage directories

@rb2k
rb2k / gist:8372402
Last active April 15, 2024 19:30
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
for (node in Jenkins.instance.nodes) {
@lestrrat
lestrrat / mecab.go
Created March 10, 2014 05:00
俺俺 golang mecabバインディング(mecabで日本語をトークナイズするためのミニマルなヤツ)
package tokenizer
/*
#cgo CFLAGS: XXX CHANGE ME XXX
#cfo LDFALGS: XXX CHANGE ME XXX
#include <mecab.h>
struct mecab_t {}
*/
import "C"
import "errors"
@exoego
exoego / 転職先に訊きたいチェックリスト.md
Last active May 25, 2024 15:30
転職活動してて訊きたいことのメモ

制度

  • 有休…
  • 病休…
  • 育休…
  • 年収(月給、賞与など)…
  • 残業代…
  • 早朝/深夜手当…
  • 休出手当…
  • 住宅補助…
@JvmName
JvmName / Android CI
Created October 28, 2014 23:57
Android CI
#Android and CI and Gradle (A How-To)
There are tech stacks in this world that make it dead simple to integrate a <abbr title="Continuous Integration">CI</abbr> build system. <br>
The Android platform is not one of them.
Although Gradle is getting better, it's still a bit non-deterministic, and some of the fixes you'll need will start to feel more like black magic than any sort of programming.
But fear not! It can be done!
Before we embark on our journey, you'll need a few things to run locally:
@umetsu
umetsu / ImageViewBindingAdapter.java
Last active May 9, 2017 00:28
Kotlin + DataBindingでハマったこと
public class ImageViewBindingAdapter {
@BindingAdapter("bind:imageUrl")
public static void loadImage(view: ImageView, url: String) {
Glide.with(view.context).load(url).into(view)
}
}
@jocollet
jocollet / RealmGsonParsing.java
Last active April 12, 2016 09:53
Example of TypeAdapters to convert json to Realm objects
// ref : https://gist.github.com/cmelchior/1a97377df0c49cd4fca9
private void initGson() {
Type tokenInt = new TypeToken<RealmList<RealmInt>>(){}.getType();
Type tokenString = new TypeToken<RealmList<RealmString>>(){}.getType();
Type tokenDate = new TypeToken<Date>(){}.getType();
mGson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.ssssss")
.setExclusionStrategies(new ExclusionStrategy() {
@Override
@carloseduardosx
carloseduardosx / RealmAutoIncrement.java
Last active January 18, 2021 05:35
RealmAutoIncrement is a singleton which maintain the last id saved from each database model
package com.carlosedurdo.database;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import io.realm.Realm;
import io.realm.RealmObject;
/**
@ypresto
ypresto / init.lua
Last active March 1, 2018 14:22
英数キーとかかなキーとかを同時押しの時だけAltキーにするHammerspoonの設定
local pressedKeyTable = {}
-- TODO: Consider about consumed per keys is necessary or not.
local consumed = false
local keyCodeTable = {}
keyCodeTable[0x66] = true -- EISUU
keyCodeTable[0x68] = true -- KANA
eventtap = hs.eventtap.new({ hs.eventtap.event.types.keyDown, hs.eventtap.event.types.keyUp }, function(event)
local keyCode = event:getKeyCode()
if keyCodeTable[keyCode] == true then