Skip to content

Instantly share code, notes, and snippets.

View josejuansanchez's full-sized avatar

José Juan Sánchez josejuansanchez

View GitHub Profile
@josejuansanchez
josejuansanchez / gist:e700a6ef47d0409a4b42
Last active August 29, 2015 14:21
[Git] Don’t type your password every time

If you’re using an HTTPS URL to push over, the Git server will ask you for your username and password for authentication. By default it will prompt you on the terminal for this information so the server can tell if you’re allowed to push.

If you don’t want to type it every single time you push, you can set up a “credential cache”. The simplest is just to keep it in memory for a few minutes, which you can easily set up by running:

git config --global credential.helper cache.

For more information on the various credential caching options available, see “Credential Storage”.

@josejuansanchez
josejuansanchez / caching-password.md
Last active August 29, 2015 14:22
Caching your GitHub password in Git
$ git config --global credential.helper cache
# Set git to use the credential memory cache

To change the default password cache timeout, enter the following:

$ git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)
@josejuansanchez
josejuansanchez / getimages.sh
Created June 3, 2015 11:36
Bash script to download images from the Helioviewer server. http://helioviewer.nascom.nasa.gov
#!/bin/bash
set -x
# Set the directory to store the images
IMAGES_DIRECTORY=images
if [ ! -d "${IMAGES_DIRECTORY}" ]; then
echo "Creando nuevo directorio: ${IMAGES_DIRECTORY}"
mkdir -p ${IMAGES_DIRECTORY}
@josejuansanchez
josejuansanchez / syncing-p2psp-fork.md
Last active August 29, 2015 14:22
Syncing a p2psp fork

Configuring a remote for a fork

  1. List the current configured remote repository for your fork.
git remote -v
  1. Specify a new remote upstream repository that will be synced with the fork.
git remote add upstream https://github.com/P2PSP/p2psp.git
@josejuansanchez
josejuansanchez / generate_short_values.c
Created September 28, 2015 10:15
generate_short_values.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
if (argc < 4) {
printf("Usage: %s <initial_value> <increment> <#total>\n", argv[0]);
return 1;
}
@josejuansanchez
josejuansanchez / AndroidManifest.xml
Created December 1, 2015 15:49
Ejemplo 01 - AsyncTask
Recuerda incluir este permiso
<uses-permission android:name="android.permission.INTERNET" />
#define PIN_ID 13
void setup() {
Serial.begin(9600);
pinMode(PIN_ID, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
@josejuansanchez
josejuansanchez / chat.py
Created February 3, 2016 08:20
Setting up a chat network on two Raspberry Pis
# A simple internet-chat application
import network
import sys
def heard(phrase):
print("them:" + phrase)
if (len(sys.argv) >= 2):
network.call(sys.argv[1], whenHearCall=heard)
@josejuansanchez
josejuansanchez / ActivityA.java
Created July 24, 2016 21:37
Stackoverflow answer, "Singleton in Android"
package com.example.testSingleton;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
@josejuansanchez
josejuansanchez / latency.markdown
Created October 12, 2016 16:52 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs