Skip to content

Instantly share code, notes, and snippets.

@ronlobo
ronlobo / osx_install.sh
Last active August 29, 2015 14:15 — forked from t-io/osx_install.sh
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@ronlobo
ronlobo / rm_from_git.sh
Created February 25, 2015 06:55
when git rm --cached -r doesn't work
git filter-branch --force --index-filter \
'git rm -r --cached --ignore-unmatch $1' \
--prune-empty --tag-name-filter cat -- --all
import 'dart:io';
import 'dart:math';
import 'dart:collection';
Line marsGround;
State marsLanderInitState;
// todo set you hostname for debugging
List<String> localHosts = [];
@ronlobo
ronlobo / string_format_function.dart
Created May 9, 2017 15:00
String format for Dart
static String format(String fmt,List<Object> params) {
int matchIndex = 0;
String replace(Match m) {
if (matchIndex<params.length) {
switch (m[4]) {
case "f":
num val = params[matchIndex++];
String str;
if (m[3]!=null && m[3].startsWith(".")) {
str = val.toStringAsFixed(int.parse(m[3].substring(1)));
@ronlobo
ronlobo / The Technical Interview Cheat Sheet.md
Created May 23, 2017 14:54 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@ronlobo
ronlobo / Blueprint.php
Created November 8, 2017 18:02 — forked from m4grio/Blueprint.php
Extending Laravel 5 Blueprint for MySqlConnection
<?php
namespace App\Database\Schema;
use Illuminate\Database\Schema\Blueprint as ParentBlueprint;
use Illuminate\Support\Facades\DB;
/**
* Class Blueprint
*
@ronlobo
ronlobo / codingame_rusty_marslander_v2.rs
Last active February 12, 2020 18:25
Genetic solution for Codingame Marslander v2 puzzle in Rust - heavily inspired by https://github.com/gzoritchak/marslander
pub mod env {
#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)]
pub enum EnvOption {
PROD,
DEV,
}
pub const ENV: EnvOption = EnvOption::PROD;
pub fn is_prod() -> bool {
@ronlobo
ronlobo / cpuinfo
Created February 14, 2020 15:43
Codingame CPU architecture with "cat /proc/cpuinfo 1>&2"
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel Core Processor (Haswell, no TSX)
stepping : 1
microcode : 0x1
cpu MHz : 2194.834
cache size : 4096 KB
physical id : 0
@ronlobo
ronlobo / main.rs
Last active February 14, 2020 16:44
Codingame thread performance test, tl;dr unthreaded runs ~2.5x faster
use std::sync::{Mutex, Arc};
use std::thread;
use std::time::Instant;
fn main() {
let threaded_counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
let timer = Instant::now();
for _ in 0..2 {
@ronlobo
ronlobo / main.rs
Last active February 14, 2020 17:33
Rust Fearless SIMD bundled for Codingame - https://github.com/raphlinus/fearless_simd
pub mod fallback {
use std::ptr;
use crate::traits::{SimdF32, SimdMask32};
impl SimdF32 for f32 {
type Raw = f32;
type Mask = u32;