Skip to content

Instantly share code, notes, and snippets.

Avatar

Andre Souza andrerocker

View GitHub Profile
@andrerocker
andrerocker / cockroachdb-ruby-pg-sample.rb
Last active Feb 15, 2018
ruby cockroachdb pg sample
View cockroachdb-ruby-pg-sample.rb
def connection
@conn ||= PG.connect({
host: ARGV.first,
port: 26257,
dbname: 'cocksparrer',
user: 'root',
sslmode: 'require',
sslrootcert: 'util/certs/cock-master/ca.crt',
sslcert: 'util/certs/cock-master/client.root.crt',
sslkey: 'util/certs/cock-master/client.root.key',
View Effective_Engineer.md

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
View gist:67adaeb145f82b5fd98cb76a36c2ac1e
Jun 28 21:19:44 nu-lost-boy_one_b01b_b62cd34_blue docker[817]: [LOST-BOY:finagle/netty3-2] DEBUG lost-boy.authorizer - {:line 158, :cid "HOOK.HOPIH.L3PMK", :log :auth-response, :message {:type "AuthAdviceResp", :body {:de10 {:decimal-indicator 6, :conv
ersion-rate 3387400}, :de39 "00", :de32 "010100", :de49 "840", :de11 "352044", :de02 "5502090000009704", :de03 {:transaction-type "00", :from-account-type "00", :to-account-type "00"}, :de06 3049, :de51 "986", :de16 #nu/month-day "--06-28", :de15 #nu/m
onth-day "--06-28", :de41 "00100213", :de07 #nu/date-and-time "--06-28,20:53:36", :de37 {:transaction-date "6180", :initiator-discritionary "203", :terminal-transaction-number "52044"}, :de04 900, :de33 "001297", :de63 {:financial-network-code "MCG", :
banknet-reference-number "DMLN26"}}}}
Jun 28 21:19:
View gist:2d4a7a1efd8a9736d86e04106c363941
un 20 19:30:05 ip-10-129-7-140.ec2.internal systemd[1]: Started Jetty-nu-mipsim.
Jun 20 19:30:10 ip-10-129-7-140.ec2.internal docker[2441]: 2016-06-20 19:30:10.469:INFO::main: Logging initialized @3877ms
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: java.lang.reflect.InvocationTargetException
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: at java.lang.reflect.Method.invoke(Method.java:497)
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: at org.eclipse.jetty.start.Main.invokeMain(Main.java:321)
Jun 20 19:30:11 ip-10-129-7-140.ec2.internal docker[2441]: at org.eclipse.jetty
@andrerocker
andrerocker / go-server_dockerfile
Created Feb 2, 2016
dockerfile go-server debian 8
View go-server_dockerfile
FROM debian:8
RUN echo 'deb http://mirror-debian.locaweb.com.br/debian jessie main contrib non-free' > /etc/apt/sources.list
RUN echo 'deb http://mirror-debian.locaweb.com.br/debian jessie-backports main contrib non-free' >> /etc/apt/sources.list
RUN echo 'deb http://dl.bintray.com/gocd/gocd-deb/ /' > /etc/apt/sources.list.d/gocd.list
RUN apt-get update
RUN apt-get install -y --force-yes go-server
RUN echo "export DAEMON=n" >> /etc/default/go-server
@andrerocker
andrerocker / threads.py
Created Nov 6, 2015
python threads cpu gil
View threads.py
import threading
def cegela():
while True:
pass
map(lambda y: y.start(), map(lambda x: threading.Thread(target=cegela), range(0,4)))
View 256color.pl
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
@andrerocker
andrerocker / Serializer.java
Created Sep 26, 2014
Serialize and unserialize any java object to a base46 string
View Serializer.java
private String serialize(Object object) {
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutputStream output = new ObjectOutputStream(buffer);
output.writeObject(object);
output.flush();
return Base64.encodeBase64String(buffer.toByteArray());
} catch (Exception e) {
View gist:3680525
mysql> use rails_girls_sp;
Database changed
mysql> select count(sex) count, sex from persons group by sex;
+--------+------+
| number | sex |
+--------+------+
| 1887 | M |
| 3 | F |
+--------+------+
2 rows in set, 1 warning (0.00 sec)
You can’t perform that action at this time.