Skip to content

Instantly share code, notes, and snippets.

View jpillora's full-sized avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@jpillora
jpillora / install-go.sh
Last active July 28, 2022 06:38
Install latest version of Go in Linux
#!/bin/bash
#force run with bash
if [ -z "$BASH_VERSION" ]
then
exec bash "$0" "$@"
return
fi
#create local scope
@jpillora
jpillora / flex.styl
Created September 17, 2014 07:56
Nib (Stylus) Flex Example
.flex
display(flex)
flex-direction(normal)
flex-direction(row)
flex-wrap(wrap)
justify-content(start)
align-content(stretch)
.item
@jpillora
jpillora / gist:24e0d0d92217e004bd67
Created October 17, 2014 08:02
Battlelog: BF4: Open all battlepacks
//submit one, look at the network tab for the post-check-sum
//paste into console
var postCheckSum = "5f5a7b128a";
$(".battlepack-item .btn").each(function() {
var id = $(this).attr("data-open-pack");
$.post("http://battlelog.battlefield.com/bf4/battlepacks/openpack/"+id, {"packId":id, "post-check-sum":postCheckSum});
});
@jpillora
jpillora / sshd.go
Last active March 28, 2025 03:25
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@jpillora
jpillora / through.js
Created January 22, 2015 18:29
Through stream
var stream = require('stream');
var Transform = stream.Transform;
module.exports = function through(opts, transform, flush) {
//use default options
if (typeof opts !== 'object') {
flush = transform;
transform = opts;
opts = {
@jpillora
jpillora / search-example.json
Last active February 3, 2022 03:08
Torrent cloud search provider specification
{
"mininova": {
"name": "Mininova",
"type": "screen-scraper",
"list": {
"url": "http://www.mininova.org/search/{query}/seeds/{page}",
"items": ".maintable > tr",
"item": {
"name":"td:nth-child(3) > a:nth-child(2)",
"url":"td:nth-child(3) > a:nth-child(2)@href",
@jpillora
jpillora / INSTALL.md
Last active February 13, 2025 01:44
Headless Transmission on Mac OS X
  1. Go to https://developer.apple.com/downloads/index.action and search for "Command line tools" and choose the one for your Mac OSX

  2. Go to http://brew.sh/ and enter the one-liner into the Terminal, you now have brew installed (a better Mac ports)

  3. Install transmission-daemon with

    brew install transmission
    
  4. Copy the startup config for launchctl with

    ln -sfv /usr/local/opt/transmission/*.plist ~/Library/LaunchAgents
    
@jpillora
jpillora / client.go
Created February 27, 2015 05:44
Go Yamux Example
package main
import (
"fmt"
"log"
"net"
"time"
"github.com/hashicorp/yamux"
)
@jpillora
jpillora / class.sublime-snippet
Last active August 29, 2015 14:16
Sublime Auto-Complete Snippet - Go Class (Golang)
<snippet>
<name>Class</name>
<tabTrigger>class</tabTrigger>
<content><![CDATA[//${1:ClassName} is ${3:...}
type ${1:ClassName} struct {
${2}
}
//New${1:ClassName} creates a new ${1:ClassName}
func New${1:ClassName}(${2/\t?(\w+) ([\.\w\*]+)(\n)?/\l$1 $2,/mg}) *${1:ClassName} {
@jpillora
jpillora / smtp-gmail-send.go
Last active January 31, 2025 04:32
Send email using Go (Golang) via GMail with net/smtp
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}