Skip to content

Instantly share code, notes, and snippets.

View ladislas's full-sized avatar
💭
...

Ladislas de Toldi ladislas

💭
...
View GitHub Profile
printf "\nCloning weareleka/chibios to chibios\n"
git clone https://github.com/weareleka/chibios --depth=1
printf "\nChanging directory to chibios\n"
cd chibios
printf "\nChanhing the fetch origin config\n"
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
printf "\nFetching the stable branch\n"
FOLDERS='
demos/LPC21xx
demos/SPC5
demos/STM32
demos/various
doc
ext
os/common/abstractions
os/common/ext
os/ex
@ladislas
ladislas / main.cpp
Created March 8, 2018 11:11
C++ Function as Parameter
#include <iostream>
// Compile & run with: g++ main.cpp -o main && ./main
using namespace std;
void caller(std::function<void(string)> func, string arg = "World") {
func(arg);
@ladislas
ladislas / main.swift
Created March 8, 2018 11:13
Swift Selector & Arguments
import Foundation
class A: NSString {
let funcName = "sayHello"
@objc func sayHello() -> Void {
print("Hello from func as selector")
}
import AppKit
let stringHTML = "<meta charset=\'utf-8\'><div style=\"color: rgb(160, 160, 160); font-family: Helvetica, Arial, sans-serif; font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: 15px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Ladislas de Toldi | cofounder &amp; ceo @<span class=\"Apple-converted-space\"> </span><a href=\"http://leka.io\" class=\"link\" style=\"color: rgb(75, 152, 209); text-decoration: none;\">Leka Inc.</a></div><div style=\"color: rgb(160, 160, 160); font-family: Helvetica, Arial, sans-serif; font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: 15px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0
for f in "$@"
do
TMP=$(mktemp)
SIZE_OLD=$(wc -c < "$f")
echo "Optimizing '$f' of size $SIZE_OLD"
/usr/local/bin/gs \
-dNOPAUSE -dBATCH -dSAFER \
-sDEVICE=pdfwrite \
@ladislas
ladislas / Gemfile
Created August 22, 2018 10:15
TicTacToe - Machine
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "colorize"
gem "terminal-table"
@ladislas
ladislas / main.cpp
Created September 5, 2018 07:49
Simple bit manipulation
#include <iostream>
#include <bitset>
// g++ main.cpp -o main && ./main
uint8_t b = 0b00000001;
int main() {
b |= (1 << 7);
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
var container = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
container.backgroundColor = UIColor.green
PlaygroundPage.current.liveView = container
import AppKit
let stringHTML = "<meta charset=\'utf-8\'><div style=\"color: rgb(160, 160, 160); font-family: Helvetica, Arial, sans-serif; font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: 15px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;\">Ladislas de Toldi | cofounder &amp; ceo @<span class=\"Apple-converted-space\"> </span><a href=\"http://leka.io\" class=\"link\" style=\"color: rgb(75, 152, 209); text-decoration: none;\">Leka Inc.</a></div><div style=\"color: rgb(160, 160, 160); font-family: Helvetica, Arial, sans-serif; font-size: 10px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; line-height: 15px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0