Skip to content

Instantly share code, notes, and snippets.

@evertonfraga
evertonfraga / ethdev.md
Last active August 25, 2017 22:41
Ambiente de desenvolvimento Ethereum

Ambiente de desenvolvimento para Ethereum

Este mini-guia compreende as ferramentas necessárias para executar contratos com o Mist e desenvolver Dapps utilizando uma rede local privada.

INSTALAÇÃO

  1. Instalar Mist
[core]
# The home folder for airflow, default is ~/airflow
airflow_home = /Users/p1nox/airflow
# The folder where your airflow pipelines live, most likely a
# subfolder in a code repository
dags_folder = /Users/p1nox/airflow/dags
# The folder where airflow should store its log files. This location
base_log_folder = /Users/p1nox/airflow/logs
@longcao
longcao / SparkCopyPostgres.scala
Last active September 11, 2024 18:55
COPY Spark DataFrame rows to PostgreSQL (via JDBC)
import java.io.InputStream
import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils
import org.apache.spark.sql.{ DataFrame, Row }
import org.postgresql.copy.CopyManager
import org.postgresql.core.BaseConnection
val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided
val connectionProperties = {
@darkseed
darkseed / knapsack_problem.scala
Created July 11, 2016 12:29 — forked from bmarcot/knapsack_problem.scala
The Knapsack Problem, in Scala -- Keywords: dynamic programming, recursion, scala.
def knapsack_aux(x: (Int, Int), is: List[Int]): List[Int] = {
for {
w <- is.zip(is.take(x._1) ::: is.take(is.size - x._1).map(_ + x._2))
} yield math.max(w._1, w._2)
}
def knapsack_rec(xs: List[(Int, Int)], is: List[Int]): List[List[Int]] = {
xs match {
case x :: xs => knapsack_aux(x, is) :: knapsack_rec(xs, knapsack_aux(x, is))
case _ => Nil
@simondobner
simondobner / postgres.md
Last active December 19, 2022 11:10
Postgres notes

Locks, Blocks and Killing sessions

Find blocked and blocking sessions

select pid,
       usename,
       pg_blocking_pids(pid) as blocked_by,
       query                 as blocked_query
from pg_stat_activity
@owainlewis
owainlewis / FTP.scala
Created April 25, 2016 19:49
Scala FTP
package io.forward.ftp
import java.io.{File, FileOutputStream, InputStream}
import org.apache.commons.net.ftp._
import scala.util.Try
final class FTP() {
private val client = new FTPClient
@jmenbo
jmenbo / upgrade_openssh_on_os_10.9.x.md
Last active May 9, 2024 19:55
Manually upgrade OpenSSH on OS 10.9.x

Manually upgrade OpenSSH on OS 10.9.x

NOTE: Installation and testing was done on a clean Mavericks (OS 10.9) installation

Install Brew:

Install Homebrew prereqs:

xcode-select --install

Install Homebrew

# -*- coding: utf-8 -*-
from django.db import models
import uuid
ANIMALS = (('DO', 'Dog'), ('CA', 'Cat'))
class Animal(models.Model):
tipo = models.CharField(max_length=2, choices=ANIMALS)
@slowkow
slowkow / ssh-tutorial.md
Last active November 7, 2025 00:56
ssh to a server without typing your password

How to ssh to a remote server without typing your password

Save yourself a few keystrokes. Follow the steps below:

  1. Run this Bash script on your laptop:

    #!/usr/bin/env bash
    

The hostname of your remote server.

@ceme
ceme / bash_curl_loop
Last active January 9, 2025 09:46
bash curl loop
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done