Skip to content

Instantly share code, notes, and snippets.

View vjames19's full-sized avatar

Victor J Reventos vjames19

View GitHub Profile
@preethamhegdes
preethamhegdes / OkHttpUtil.java
Last active April 23, 2024 17:03
OkHttp Client Ignore certificate
import okhttp3.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.*;
import java.net.*;
import java.security.cert.CertificateException;
/*
okhttp version used 3.8.1
@pyricau
pyricau / LeakSlackUploadService.java
Created May 9, 2015 00:03
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@vjames19
vjames19 / 1_README.md
Last active August 29, 2015 13:59
golang tour exercise solutions

Golang Tour Exercise solutions

@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@iMagdy
iMagdy / node_apache.apacheconf
Last active February 25, 2020 00:46
This virtualhosts snippet will make your nodejs app run on the traditional port 80, so mynodeapp.com:3000 will simply work on mynodeapp.com without adding :3000. it's that simple :) remember to enable apache modules proxy and proxy_http ($ sudo a2enmod proxy && sudo a2enmod proxy_http)
<VirtualHost *:80>
ServerAdmin isl@m.magdy
ServerName js.io
ServerAlias js.io
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
@vjames19
vjames19 / EclipseWorkspaceCreatorKeepingPreferences.py
Last active December 17, 2015 03:29
Copies the preferences from the src workspace to the dest workspace. If the dest workspace doesn't exist it will be created. Enjoy!
'''
Created on May 8, 2013
@author: Victor J. Reventos
Copies the preferences from the src workspace to the dest workspace.
If the dest workspace doesn't exist it will be created.
Enjoy!
'''
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD