Skip to content

Instantly share code, notes, and snippets.

@flagoworld
flagoworld / gist:9480365
Created March 11, 2014 06:04
For Loops
//A for loop is a loop dictated by 3 expressions
for(
//This is executed once at the beginning of the loop
var i=0;
//The loop continues as long as this evaluates to TRUE
i<5;
//This is executed at the end of every iteration
++i
)
{
@flagoworld
flagoworld / gdb_php.log
Created March 19, 2014 17:33
Calling "php" gives "Illegal Instruction"
Starting program: /usr/bin/php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0xb6e0b5e0 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) bt
#0 0xb6e0b5e0 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
Cannot access memory at address 0x0
#1 0xb6e07fc4 in OPENSSL_cpuid_setup () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
NSDateFormatter *f = [NSDateFormatter new];
f.dateFormat = @"M/d/yyyy";
NSLog(@"Date: %@", [f dateFromString:@"8/29/2014"]);
//Logs:
// Date: 2014-08-29 07:00:00 +0000
@flagoworld
flagoworld / gist:a1aab80580966a42e7f6
Created November 24, 2014 02:28
BMW2002 checklist
BMW 2002 Checks
Rust
shock towers
floor pans / The driver and passenger floors
spare tire well in the trunk
The lower rocker panels on each side of the car
The gas tank area
mainly look in those spots as those the hard places to fix it
@flagoworld
flagoworld / lol.m
Last active August 29, 2015 14:15
lol
NSDictionary *cases = @{
@"name": ^{
return field.name;
},
@"type": ^{
return field.typeString.lowercaseString;
}
}
void (^block)() = cases[ident];
@flagoworld
flagoworld / RangeStreamer.h
Last active May 1, 2019 02:48
AVAssetResourceLoaderDelegate - Stream from server that requires specific auth headers
//
// RangeStreamer.h
// iOS Player
//
// Created by Ryan Layne on 4/2/15.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@flagoworld
flagoworld / lin-master.js
Last active August 29, 2015 14:22
first stages of a nodejs LIN master
var async = require('async');
var _ = require('lodash');
var SerialPort = require('serialport');
// SerialPort.list(function (err, ports) {
// ports.forEach(function(port) {
// console.log(port.comName);
// console.log(port.pnpId);
// console.log(port.manufacturer);
// });
@flagoworld
flagoworld / gstore.rs
Created July 21, 2015 04:33
gstore multi type hashmap
use std::any::Any;
use std::collections::HashMap;
use std::fmt;
pub struct GStore
{
map: HashMap<String, Box<Any>>
}
impl GStore
@flagoworld
flagoworld / pack.m
Last active August 29, 2015 14:27
packing some data
- (NSData *)build
{
uint32_t type = _type; // 0
uint32_t command = _command; // 3
NSString *data = _data; // @""
unsigned char byte = 0x00; // 0
unsigned long size = sizeof(command) + sizeof(type) + data.length + sizeof(byte); // 9
unsigned long totalSize = sizeof(uint32_t) + size; // 10 (including size uint32)
unsigned char bytes[totalSize];
import os
from threading import Thread
from time import sleep
import asyncio
FIFO_PATH = "/path/to/crash-log"
class FifoReader(Thread):
def __init__(self, path, crash):
super().__init__()