$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A shortcut function that simplifies usage of xclip. | |
# - Accepts input from either stdin (pipe), or params. | |
# Taken from: http://madebynathan.com/2011/10/04/a-nicer-way-to-use-xclip/ | |
# ------------------------------------------------ | |
cb() { | |
local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m' | |
# Check that xclip is installed. | |
if ! type xclip > /dev/null 2>&1; then | |
echo -e "$_wrn_col""You must have the 'xclip' program installed.\e[0m" | |
# Check user is not root (root doesn't have access to user xorg server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
lg, positions := largestNumber([]int{71, 114, 105, 109, 84, 104, 101, 82, 101, 97, 112, 101, 114}) | |
fmt.Printf("Largest Number: %v\n", lg) | |
fmt.Print("Positions: ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
a := []string{"arrays", "are", "go away", "fun"} | |
i := 2 | |
a = append(a[:i], a[i+1:]...) | |
fmt.Println(a) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
s := []string{"pig", "big", "sig", "pig", "lig", "tig", "pig", "sig", "kig", "pig"} | |
s = removeString(s, "pig") | |
fmt.Println(s) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class main { | |
public static void main(String[] args) { | |
resonate("/home/user/Pictures/Archives","/home/user/Pictures"); | |
} | |
public static void resonate(String lists, String reduce){ | |
File f1 = new File(lists); | |
if (f1.exists() && f1.isDirectory()){ | |
for (File f2: f1.listFiles()){ | |
File f3 = new File(reduce+"/"+f2.getName()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// based on gist | |
// https://gist.github.com/ir4y/11146415 | |
// http://stackoverflow.com/questions/21417223/simple-ssh-port-forward-in-golang | |
// obro conexio ssh amb el server remot. | |
// tot el que envio al port local ho copio al port remote | |
// a traves de la conexio remota. Per tant he d'obrir un | |
// port a la maquina remota? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of how to preparse a JSON String. | |
// Useful if the json is massive and what you are looking for is on the top. | |
// | |
// Use: | |
// preParseString(JSONKey, JSONBody) => Value of JSONKey, or "" if not found. | |
// | |
func preParseString(key string, body []byte) string { | |
var buffer []byte | |
level := 0 | |
qO := false // quoteOpen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv/cv.h> | |
#include <opencv/highgui.h> | |
#include <opencv/ml.h> | |
void doMosaic(IplImage* in, int x, int y, | |
int width, int height, int size); | |
int main (int argc, char **argv) | |
{ | |
int i, c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package triggertypes | |
import "time" | |
// RequestMade ... | |
type RequestMade struct { | |
Requester int `json:"requester"` // sapphire userID | |
RequestID int `json:"requestID"` | |
EventID int `json:"eventID"` | |
CreatedDate *time.Time `json:"createdDate"` // Here just incase its lost or delayed. |
OlderNewer