Skip to content

Instantly share code, notes, and snippets.

View bl4ckb0ne's full-sized avatar

Simon Zeni bl4ckb0ne

  • Collabora
  • Canada
View GitHub Profile
#!/bin/bash
source $(dirname $0)/config
USED=$(ps -eo pcpu | awk 'BEGIN {sum=0.0f} {sum+=$1} END {print sum}')
output="%{F$COLOR_ICON} %{F-}$USED"
echo $output $DIV;
@bl4ckb0ne
bl4ckb0ne / Vector2D.hx
Created June 3, 2015 23:09
Fuck you Array<Array<T>>
package utils;
// From https://github.com/nadako/HaxeDungeons/blob/master/src/dungeons/utils/Grid.hx
class Vector2D<T>
{
public var width(default, null):UInt;
public var height(default, null):UInt;
private var grid:Array<T>;
#!/bin/sh
# Program to use the command install recursivly in a folder
magic_func() {
echo "entering ${1}"
echo "target $2"
for file in $1; do
if [ -f "$file" ]; then
@bl4ckb0ne
bl4ckb0ne / changemac.sh
Created August 15, 2016 13:42
FUCK YOU OUIBUS
#!/bin/sh
echo "Current MAC address"
MAC=`ip link show wlp2s0 | awk '/ether/ {print $2}'`
echo $MAC
MAC=`echo $MAC | cut -d: -f1-3`
echo "Building new MAC address"
struct Node<T>
{
id: u32,
data: T,
left: Option<Box<Node<T>>>,
right: Option<Box<Node<T>>>,
parent: Option<Box<Node<T>>>,
}
struct Tree<T>
// Example program
#include <iostream>
#include <string>
#include <vector>
template<typename T>
void print(std::vector<T>& v)
{
for(auto it : v)
@bl4ckb0ne
bl4ckb0ne / sig_handler.cpp
Last active January 26, 2017 23:30
Handle a signal and give it to anything
#include <csignal>
#include <iostream>
#include <thread>
namespace
{
volatile std::sig_atomic_t gSignalStatus = 0;
}
class Foo
#include <iostream>
#include <cstring>
int main()
{
float* biga = new float[6];
float* a = new float[3];
a[0] = 1.0f;
a[1] = 1.0f;
#include <string>
#include <vector>
#include <tuple>
#include <iostream>
#include <experimental/tuple>
#define HI std::cout << __PRETTY_FUNCTION__ << '\n';
template <class Sig>
struct MsgQueue;
@bl4ckb0ne
bl4ckb0ne / smartptr_operator.cpp
Created March 26, 2017 20:26
Access an operator of an object inside a smart ptr http://coliru.stacked-crooked.com/a/f811a7e99cb58873
#include <iostream>
#include <vector>
#include <string>
#include <memory>
struct Foo
{
Foo(int size) : words(size, "Foo")
{}