Skip to content

Instantly share code, notes, and snippets.

View ysinjab's full-sized avatar
🎯
Focusing

Yasser Sinjab ysinjab

🎯
Focusing
View GitHub Profile

When you modify a file in your repository, the change is initially unstaged. In order to commit it, you must stage it—that is, add it to the index—using git add. When you make a commit, the changes that are committed are those that have been added to the index.

git reset changes, at minimum, where your current branch is pointing. The difference between --mixed and --soft is whether or not your index is also modified. So, if we're on branch master with this series of commits:

- A - B - C (master)

HEADpoints to C and the index matches C.

--soft

@mraaroncruz
mraaroncruz / JSONB.go
Created June 8, 2016 12:33
JSONB for postgres in Golang
// Found in this issue thread https://github.com/jinzhu/gorm/issues/516#issuecomment-109055198
// License unknown
//
//
// Postgres' JSONB type. It's a byte array of already encoded JSON (like json.RawMessage)
// which also saves itself correctly to PG's jsonb type. It would probably also work on
// PG json types.
type JSONB []byte
func (j JSONB) Value() (driver.Value, error) {
@dvirsky
dvirsky / crc16_slottable.h
Last active July 21, 2024 19:50
A table of the shortest possible alphanumeric string that is mapped by redis' crc16 to any given cluster slot. the
#ifndef _CRC16_TABLE_H__
#define _CRC16_TABLE_H__
/* A table of the shortest possible alphanumeric string that is mapped by redis' crc16
* to any given redis cluster slot.
*
* The array indexes are slot numbers, so that given a desired slot, this string is guaranteed
* to make redis cluster route a request to the shard holding this slot
*/
@Ryanb58
Ryanb58 / install.md
Last active October 4, 2024 11:11
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@jeechu
jeechu / hashify.go
Last active June 20, 2024 18:42
Feature vectorization using hashing trick in golang
func hashify(appList []string, vectorLength int64) ([]int){
hashedList := make([]int, vectorLength)
for _, app := range appList {
hashedValue := sha256.New()
hashedValue.Write([]byte(app))
hexStr := fmt.Sprintf("%x", hashedValue.Sum(nil))
hexInt := new(big.Int)
hexInt, ok := hexInt.SetString(hexStr, 16)
if !ok {
@joaom182
joaom182 / values-production.yml
Created March 22, 2020 14:11
values.yml for bitnami/kafka helm chart
## Global Docker image parameters
## Please, note that this will override the image parameters, including dependencies, configured to use the global value
## Current available global Docker image parameters: imageRegistry and imagePullSecrets
##
# global:
# imageRegistry: myRegistryName
# imagePullSecrets:
# - myRegistryKeySecretName
# storageClass: myStorageClass