Skip to content

Instantly share code, notes, and snippets.

View ossareh's full-sized avatar

P. Michael Ossareh ossareh

View GitHub Profile
@ossareh
ossareh / CMakeLists.txt
Created July 21, 2020 16:29 — forked from hovren/CMakeLists.txt
pybind11 with CMake and setup.py
# Build a Python extension module using pybind11
# pybindings_add_module(<module>)
# Here <module> should be the fully qualified name for the module,
# e.g. pybindings_add_module(foo.bar._baz)
# <module> becomes the target name in case you wish to do something to it later
# The source for the binding *must* be placed in src/pybindings/{relpath}/py{name}.cc
# E.g. for module=foo.bar._baz -> src/pybindings/bar/py_baz.cc
function(pybindings_add_module module)
set(target_name ${module})
string(REPLACE "." "/" modpath ${module})

In github we can add editable todo lists:

  • here is an unchecked element
  • here is a checked one
@ossareh
ossareh / async.js
Last active August 20, 2018 01:10
wut?
#!/usr/bin/env node
const inputs = [false, false, false, true, false, false];
const fast = (i, d) => {
console.log(`run ${d}`);
return i;
};
const slow = async (i) => {
return new Promise((resolve, reject) => {

Keybase proof

I hereby claim:

  • I am ossareh on github.
  • I am ossareh (https://keybase.io/ossareh) on keybase.
  • I have a public key ASCDpytm2j9S46-A1Wg1i514M_kbo8sjnskIFi4zNfTG_Ao

To claim this, I am signing this object:

@ossareh
ossareh / commands on the shell
Created October 16, 2014 20:33
steps to clean up excessive launch configs
$ sudo apt-get install awscli
$ aws configure
$ aws autoscaling describe-launch-configurations | grep LaunchConfigurationName | cut -d '"' -f4 > all_lcs
$ aws autoscaling describe-auto-scaling-groups | grep LaunchConfigurationName | cut -d '"' -f4 | sort -u > used_lcs
$ ./delete.py > delete_lcs
$ for i in `cat delete_lcs`; do aws autoscaling delete-launch-configuration --launch-configuration-name ${i}; done
@ossareh
ossareh / fetch_asgard.py
Last active August 29, 2015 13:57
Simple script to fetch latest asgard build
#!/usr/bin/env python2
# The MIT License (MIT)
#
# Copyright (c) 2014 Michael Ossareh & Twitch Interactive, Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
$ cat echo.c
#include <stdio.h>
int main() {
int c;
while ((c = getchar()) != EOF) {
putchar(c);
}
@ossareh
ossareh / gist:2154684
Created March 22, 2012 00:40
devise flay
$ find . -type f -name '*.rb' | xargs flay
parse error on value "table_name" (tIDENTIFIER)
skipping ./lib/generators/active_record/templates/migration.rb
parse error on value "table_name" (tIDENTIFIER)
skipping ./lib/generators/active_record/templates/migration_existing.rb
Total score (lower is better) = 6797
1) Similar code found in :iter (mass = 306)
./test/routes_test.rb:162
@ossareh
ossareh / gist:2154670
Created March 22, 2012 00:39
devise flog
$ find . -type f -name '*.rb' | xargs flog
#<Racc::ParseError:
parse error on value "table_name" (tIDENTIFIER)> at /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:350:in `on_error', /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:99:in `_racc_do_parse_c', /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:99:in `__send__', /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:99:in `do_parse', /usr/share/ruby-rvm/gems/ree-1.8.7-2011.03@jtv_rails3/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:750:in `process'
...stupid lemmings and their bad erb templates... skipping
#<Racc::ParseError:
parse error on value "table_name" (tIDENTIFIER)> at /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:350:in `on_error', /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:99:in `_racc_do_parse_c', /usr/share/ruby-rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/racc/parser.rb:99:in `__send__',