Skip to content

Instantly share code, notes, and snippets.

View rfns's full-sized avatar
💭
Improving myself

Rubens F. rfns

💭
Improving myself
  • South Jaragua, St. Catarina
View GitHub Profile
@TekWizely
TekWizely / serialize_array.bash
Last active August 4, 2022 17:02
Script to Serialize / Deserialize a Bash Array to/from a String - Requires knowing one character NOT present in the array, to be used as the separator.
# shellcheck shell=bash
##
# serialize_array
# Serializes a bash array to a string, with a configurable seperator.
#
# $1 = source varname ( contains array to be serialized )
# $2 = target varname ( will contian the serialized string )
# $3 = seperator ( optional, defaults to $'\x01' )
#
@x-yuri
x-yuri / docker + mongo + mongoid.md
Last active February 20, 2023 12:28
docker + mongo + mongoid
@x-yuri
x-yuri / docker: mongo.md
Last active February 20, 2023 12:28
docker: mongo

Without either MONGO_INITDB_ROOT_USERNAME, or MONGO_INITDB_ROOT_PASSWORD the access is unrestricted.

docker-compose.yml:

version: '3'

services:
  mongo:
    image: mongo:4
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active May 7, 2024 19:33
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@MatrixManAtYrService
MatrixManAtYrService / locustfile.py
Created February 6, 2019 18:47
example of keeping tasks on a single class
from locust import HttpLocust, TaskSet, task
import json
class UserBehavior(TaskSet):
def on_start(self):
# this retrieves a coookie from the server and stores in in a RequestsCookieJar: self.locust.client.cookes
# that is, it stores the cookie on an instance of this class, not the class itself (as your code does)
# your server may have different requirements for how the login request should look, but this worked for me
self.client.post("/login",
@Mahabali
Mahabali / gist:64310f94af17a53514476f9b0454bad4
Created December 7, 2018 03:51
Dealing with "error: exportArchive: No "iOS In House" profiles for team" or error: exportArchive: No "adhoc " profiles for team
Below is a common error when trying to setup CI/CD using fastlane or raw XcodeBuild/Xcrun command
"error: exportArchive: No "iOS In House" profiles for team" or error: exportArchive: No "adhoc In House" profiles for team
Fixing it :
1) Easiest way is to make a build archive in Xcode, Export using organizer and Saving it in a folder.
2) Go to the folder, open Export Options.plist and replicate the same in Fastlane - build_app or gym - export options
3) In case of XcodeBuild - Replace the same in Export Options.plist which is provided in XCodeBuild command and try again
4) Make a build, thank me .
@ajdruff
ajdruff / fix-git-line-endings
Last active February 29, 2024 13:02
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@cschmidli
cschmidli / DataTable.ts
Last active April 17, 2019 20:27
Semantic UI Data Table Component
import * as React from 'react';
import * as hash from 'object-hash';
import {
TableProps,
Table,
TableBody,
TableCell,
TableFooter,
TableHeaderCell,
@ljharb
ljharb / array_iteration_thoughts.md
Last active April 29, 2024 17:13
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu