Skip to content

Instantly share code, notes, and snippets.

View klashxx's full-sized avatar
💭
I may be slow to respond.

Juan Diego Godoy Robles klashxx

💭
I may be slow to respond.
View GitHub Profile
@klashxx
klashxx / clean_code.md
Created June 24, 2020 11:55 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@klashxx
klashxx / keep.sh
Last active December 2, 2019 10:51
alias keep='while :; do for c in \| \/ - \\;do printf "$c";sleep 3;tput cub 3; tput el;done;done'
alias keep='while :; do echo -n ".";sleep 300;done'

defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 53 defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 53 defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 53 sudo killall coreaudiod

@klashxx
klashxx / list_dirs.go
Last active September 18, 2019 12:36
func listDirectories(path string) ([]string, error) {
names := []string{}
items, err := ioutil.ReadDir(path)
if err != nil {
return names, err
}
for _, item := range items {
// We only want directories
if item.IsDir() {
@klashxx
klashxx / dino.sh
Last active July 9, 2019 12:35
FB coding interview problem solved by awk
awk -F, 'FNR>1 && NR==FNR{a[$1]=$2+0;next}
FNR>1 && $3=="bipedal"{
leg=a[$1]+0
stride=$2+0
speed=(leg==0 || stride == 0 ) ? 0 : ((stride / leg) - 1) * sqrt(leg * (9.8 ** 2))
print $1, speed
}
' dataset1.csv dataset2.csv | sort -nr -k 2|awk '{print $1}'
#!/bin/bash
[[ $# -ne 0 ]] && { fs="${1}"; shift; } || fs="."
[[ ! -d $fs || ! -r $fs ]] && { echo "not dir/cant read it"; exit 5; }
[[ $# -ne 0 ]] && tam=$1 || tam=1
[[ ! $tam =~ ^[0-9]{1,}$ ]] && { echo "param must be a number (mbs)"; exit 5; }
(( tam *= 1024 * 1024 ))
find $fs -size +${tam}c -exec ls -ln {} \; 2>/dev/null | \
sort -r -k 5n | \
awk '{printf("%12.3f %s %s %s %s\n", $5/1024/1024, $NF, "("$7,$6,$8")")}'
exit 0
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'dart:io' show Platform;
import 'package:flutter/cupertino.dart';
import './events.dart';
import './members.dart';
import './galery.dart';
void main() {
runApp(LunaRojaApp());
['FizzBuzz' if not i%3 and not i%5 else 'Fizz' if not i%3 else 'Buzz' if not i%5 else i for i in range(1,101)]
date --date="@$(($(date +%s --date="$(./mbghrtime|grep -oP '\d{4}-\d{2}-\d{2}\s[\S]+\sUTC')") + 10))"
<InlineMessage
type="error"
title="Long Line Warp"
secondaryText="">
<div dangerouslySetInnerHTML={{ __html: '<p>' + longLine.trim().match(/.{1,80}/g).join('<br>') + '</p>' }} />
</InlineMessage>