Skip to content

Instantly share code, notes, and snippets.

View esiqveland's full-sized avatar

Eivind Siqveland Larsen esiqveland

View GitHub Profile
@slagdang
slagdang / enable_trim.sh
Last active December 10, 2015 19:58 — forked from woods/enable_trim.sh
This script will enable TRIM support for 3rd Party SSDs on Mountain Lion and later. It will enable TRIM for ALL 3rd Party SSDs, so if you have two SSDs in your system, best be sure both support TRIM before running this. It is unclear if this patch also enables TRIM for rotational media, I'd have to look at the Darwin source to find that out.
#!/bin/bash
#
# Enable TRIM support for 3rd Party SSDs. Works for Mountain Lion, should work on earlier OSes too.
# Tested on 10.8.2, 10.8.3, 10.8.5, 10.9.0-10.9.5, 10.10.0-10.10.1, 10.10.4
#
# Run this script at your own risk, whether on 10.10 or earlier.
#
# This script works on MacOS 10.10-10.10.1 (Yosemite) but it has significant system security repercussions.
# To use it you must disable kext signing on your machine. This makes it easier for
# malware to infect your machine by disabling the feature which would detect unsigned
@ficusk
ficusk / GsonRequest.java
Last active April 9, 2024 09:03
A Volley adapter for JSON requests that will be parsed into Java objects by Gson.
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
package nettimeout
import (
"net"
"time"
)
// Listener wraps a net.Listener, and gives a place to store the timeout
// parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type Listener struct {
@acolyer
acolyer / service-checklist.md
Last active June 20, 2024 08:47
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@mrserverless
mrserverless / JdbiIntegrationTest.java
Last active August 29, 2015 14:08 — forked from thody/JdbiIntegrationTest.java
Dropwizard JDBI Integration Test slightly more simplified and upgraded to Dropwizard version 0.7.1
public abstract class JdbiIntegrationTest {
protected DBI dbi;
private Handle handle;
private Liquibase liquibase;
protected abstract DataSourceFactory getDataSourceFactory();
@mrserverless
mrserverless / Configuration.java
Last active March 14, 2019 12:08
Dropwizard serving Static Assets on Root URL "/" and APIs on "/api/"
public class ApplicationConfiguration extends Configuration implements AssetsBundleConfiguration {
@Valid
@NotNull
@JsonProperty
private AssetsConfiguration assets;
@Override
public AssetsConfiguration getAssets() {
return assets;
}
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@mbrevoort
mbrevoort / gist:dcdbbb4e2d5b2f62f407
Created June 1, 2015 06:08
CircleCI Circle.yml for building Godeps backed Go service and building and pushing to private docker registry
machine:
services:
- redis
- docker
environment:
PROJECT_NAME: <your-project>
checkout:
post:
@ricardo-rossi
ricardo-rossi / maven-333.sh
Last active September 17, 2020 09:42 — forked from ervinb/maven-333.sh
Install Maven 3.3.3 on Ubuntu 14.04
#!/bin/sh
sudo apt-get purge -y maven
if ! [ -e apache-maven-3.3.3-bin.tar.gz ]; then (curl -OL http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz); fi
sudo tar -zxf apache-maven-3.3.3-bin.tar.gz -C /usr/local/
sudo ln -s /usr/local/apache-maven-3.3.3/bin/mvn /usr/bin/mvn
echo "Maven is on version `mvn -v`"
@igouss
igouss / ObservableQuery.java
Created September 22, 2015 22:12
RxJava and Hibernate Scrollable query Raw
package com.naxsoft.database;
import org.hibernate.Query;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.StatelessSession;
import rx.Observable;
/**
* Copyright NAXSoft 2015