Skip to content

Instantly share code, notes, and snippets.

@frenchie4111
frenchie4111 / GetFilesInDirectory
Last active February 9, 2023 00:58
Find All Files In Directory C++
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
#include <windows.h>
using namespace std;
void GetFilesInDirectory(std::vector<string> &out, const string &directory, bool getFolderNames)
{
@frenchie4111
frenchie4111 / Remove Spaces
Created May 11, 2014 20:59
Remove Spaces
void remove_spaces( string *s ) {
while( isspace( s->c_str()[0] ) ) {
s->erase(0,1);
}
}
int main() {
string s = "\t\tHello World";
cout << "Before: " << s << endl;
remove_spaces( &s );
@frenchie4111
frenchie4111 / BindableService.java
Last active August 29, 2015 14:02
Android service binding
public abstract class BindableService extends Service
{
LocalBinder binder = new LocalBinder();
public class LocalBinder extends Binder {
Service getService() {
// Return this instance of LocalService so clients can call public methods
return BindableService.this;
}
};
### Keybase proof
I hereby claim:
* I am frenchie4111 on github.
* I am mlyons (https://keybase.io/mlyons) on keybase.
* I have a public key whose fingerprint is B150 425B 8B07 8720 E285 A967 1342 FF93 ED20 68BC
To claim this, I am signing this object:
@frenchie4111
frenchie4111 / gist:ccc0d74ef75b9c3b31fe
Created June 14, 2015 02:03
Get licenses from package.json
/*
* Note: The code in this gist is in no way meant to be pretty, please do not judge my coding abilities
* based on it
*/
var package = require( './package.json' ),
_ = require( 'underscore' ),
q = require( 'q' ),
exec = require( 'child_process' ).exec;
export default function( promises ) {
var caught_promises = promises.map( function( promise ) {
return promise.catch( function() {} );
} );
return Promise.all( caught_promises );
};
#!/bin/bash
# This is a super simple script that blindly installs things
# from AUR
git clone https://aur.archlinux.org/${1}.git
cd ${1}
makepkg -sri
@frenchie4111
frenchie4111 / hn_frontpage_scrape.js
Created April 2, 2016 23:34
Example Node (4) script that pulls posts from the front page of Hacker News
/**
* Copyright (C) 2016 Michael Lyons
*
* This software may be modified and distributed under the terms
* of the MIT license.
*/
var _ = require( 'underscore' ),
q = require( 'q' ),
request = require( 'request' ),

This is the format of my ~/programming folder:

~/programming
    archive/
        // This houses archived companies, I still want to keep their code, but
        // I don't need to see it every day    
    personal/
        archive/
            projects/
@frenchie4111
frenchie4111 / Hashflare_History_Scraper.js
Created July 8, 2017 15:46
Tampermonkey Script for getting my Hashflare.io history
// ==UserScript==
// @name Hashflare History Scraper
// @version 0.1
// @author Mike Lyons <mdl0394@gmail.com>
// @match https://hashflare.io/panel/history
// @require http://code.jquery.com/jquery-3.2.1.min.js
// @require https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.js
// @require https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.13/moment-timezone-with-data.js