Skip to content

Instantly share code, notes, and snippets.

View nfx's full-sized avatar

Serge Smertin nfx

View GitHub Profile
@nfx
nfx / git.md
Last active November 24, 2023 11:28
git commands

Some commands are repeated so often, but one may forget the exact syntax

Squash all commits on branch

From this stackoverflow comment:

git reset $(git merge-base $(git config --get init.defaultBranch || echo main) $(git branch --show-current)) && git add -A && git commit
@nfx
nfx / SAMPLE_CLA
Created September 30, 2022 20:59
### Nfx01 CLA
Thank you for your interest in contributing. This is sample CLA for a totally dummy org.
You agree that the following terms apply to all of your past, present and future Contributions.
@nfx
nfx / golang-tls.md
Created August 13, 2022 18:45 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@nfx
nfx / add-resource.diff
Last active October 13, 2021 18:35
databricks_job_task resource WIP
diff --git a/compute/model.go b/compute/model.go
index 1a2b43a2..b71afb6a 100644
--- a/compute/model.go
+++ b/compute/model.go
@@ -612,6 +612,21 @@ func (j Job) ID() string {
return fmt.Sprintf("%d", j.JobID)
}
+func (j Job) hasTask(taskKey string) bool {
+ if j.Settings == nil {
@nfx
nfx / custom-set-hashcode-wip.diff
Last active October 12, 2021 15:16
Databricks Terraform provider to respect DiffSuppressFuncs for `slice_set` fields
diff --git a/common/reflect_resource.go b/common/reflect_resource.go
index 12341451..1f832d98 100644
--- a/common/reflect_resource.go
+++ b/common/reflect_resource.go
@@ -1,9 +1,11 @@
package common
import (
+ "bytes"
"fmt"
# modules/databricks-cluster-policy/main.tf
variable "team" {
description = "Team that performs the work"
}
variable "policy_overrides" {
description = "Cluster policy overrides"
}
locals {
default_policy = {
"dbus_per_hour" : {
---
hasher:
build: hasher
ports:
- "8002:80"
redis:
image: redis
rng:
build: rng
ports:
@nfx
nfx / gist:3139512
Created July 18, 2012 22:54
Mockoko - yet another PHPUnit mocking shortcut
<?php
/**
* Yet another PHPUnit wrapper for mocking
*
* To enable, just add the following line in your base testcase:
*
* Mockoko::getInstance()->setTestCase($this);
*
* To use, just make your mocks as
@nfx
nfx / integration-concept.php
Created June 19, 2012 18:25
Integrate any webservice to PHP project easily
<?php
/**
* @Service("rest_bindable")
*/
class RestBindableConcept {
public function getAllUserLists(User $user) {
$lists = $this->getListsByName($user->twitterUsername);
foreach($lists as $someList) {
echo $someList->getNameAndDescription();