Skip to content

Instantly share code, notes, and snippets.

View daniel-garcia's full-sized avatar

Daniel García daniel-garcia

View GitHub Profile
@daniel-garcia
daniel-garcia / simple_ssh_server.go
Created September 14, 2012 04:28
simple ssh server
package main
import (
"fmt"
"io/ioutil"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"
)
@daniel-garcia
daniel-garcia / gist:2790549
Created May 25, 2012 21:06
Patch restorage to use INSERT ON DUPLICATE KEY UPDATE
--- relstorage/adapters/mover.py.orig 2012-05-25 16:56:17.000000000 -0400
+++ relstorage/adapters/mover.py 2012-05-25 16:57:16.000000000 -0400
@@ -864,11 +864,23 @@ class ObjectMover(object):
else:
if self.database_name == 'mysql':
stmt = """
- REPLACE INTO object_state (zoid, tid, state_size, state)
- SELECT zoid, %s, COALESCE(LENGTH(state), 0), state
- FROM temp_store
+ INSERT INTO object_state (zoid, tid, state_size, state)

asdfasdf

vagrant plugin install vagrant-proxyconf
mkdir -p ~/.vagrant.d
cat <<EOF > ~/.vagrant.d/Vagrantfile
Vagrant.configure("2") do |config|
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://www-proxy.us.oracle.com:80/"
config.proxy.https = "http://www-proxy.us.oracle.com:80/"
config.proxy.no_proxy = "localhost,127.0.0.1,.example.com"
end
# ... other stuff
@daniel-garcia
daniel-garcia / gist:8567777
Last active January 4, 2016 04:19
external dependencies for a golang project
go list -f '{{join .Deps "\n"}}' | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
@daniel-garcia
daniel-garcia / main.go
Created January 15, 2014 21:19
nonblocking read from subprocess
package main
import (
"log"
"os"
"os/exec"
"syscall"
"time"
)
$ go run client.go
2012/03/28 22:30:21 client: connected to: 127.0.0.1:8000
Client: Server public key is:
[48 129 159 48 13 6 9 42 134 72 134 247 13 1 1 1 5 0 3 129 141 0 48 129 137 2 129 129 0 188 73 207 11 137 150 106 118 45 27 12 18 76 183 252 31 22 193 109 43 118 130 188 244 197 136 26 55 239 51 225 67 171 20 87 35 107 190 16 158 181 84 225 159 112 70 131 173 136 181 130 151 156 4 142 141 218 100 116 219 228 211 136 155 179 220 50 21 181 134 211 72 22 38 226 51 170 165 39 65 231 3 15 26 54 193 142 242 28 66 96 88 138 237 217 65 144 89 231 177 179 200 116 30 45 148 174 56 57 244 29 17 8 22 86 54 215 14 207 55 223 164 216 184 21 46 29 233 2 3 1 0 1] <nil>
2012/03/28 22:30:21 client: handshake: true
2012/03/28 22:30:21 client: mutual: true
2012/03/28 22:30:21 client: wrote "Hello\n" (6 bytes)
2012/03/28 22:30:21 client: read "Hello\n" (6 bytes)
2012/03/28 22:30:21 client: exiting
$
@daniel-garcia
daniel-garcia / Dockerfile
Created August 13, 2013 21:09
docker file for zenoss development
# Zenoss 4.x development environment
FROM centos
MAINTAINER Daniel Garcia <dgarcia@zenoss.com>
RUN yum install -y which
RUN echo "10.175.210.69 cmyum.zenoss.loc" >> /etc/hosts
RUN yum install -y http://cmyum.zenoss.loc/yum/zenossdeps-private-4.2.x-1.el6.noarch.rpm
RUN for i in /etc/yum.repos.d/CentOS-*.repo; do sed -i 's/mirrorlist/#mirrorlist/g' $i; done
@daniel-garcia
daniel-garcia / pf.go
Created July 16, 2013 14:54
simple port forwarder
package main
import (
"io"
"log"
"net"
"os"
)
func main() {
Index: Products/ZenUtils/zencatalog.py
===================================================================
--- Products/ZenUtils/zencatalog.py (revision 74143)
+++ Products/ZenUtils/zencatalog.py (working copy)
@@ -115,6 +115,10 @@
action="store_true",
default=False,
help="Create global catalog and populate it")
+ self.parser.add_option("--continueindex",
+ action="store_true",