load without any analysis (file header at offset 0x0): r2 -n /path/to/file
- analyze all:
aa - show sections:
iS - list functions:
afl - list imports:
ii - list entrypoints:
ie - seek to function:
s sym.main
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| // Simple Scala-like for comprehension for rust | |
| macro_rules! comp( | |
| // base case, using "map" | |
| (val $id:ident <- $expr:expr $(,if $cond:expr)* $(,let $assign_id:pat = $assign_val:expr)* ,yield $comp:expr) => | |
| ( | |
| ($expr)$(.filtered(|&$id| $cond))*.map(|&$id| { | |
| $(let $assign_id = $assign_val;)* $comp | |
| } | |
| ) |
| package slicks.docs.dao | |
| import scala.slick.driver.PostgresDriver.simple._ | |
| import scala.slick.driver._ | |
| trait Profile { | |
| val profile: JdbcProfile | |
| } |
| Disclaimer: The instructions are the collective efforts from a few places online. | |
| Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did. | |
| First off, bundle. | |
| ================== | |
| 1. cd to the project directory | |
| 2. Start the react-native packager if not started | |
| 3. Download the bundle to the asset folder: | |
| curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" |
| # This is just a cheat sheet: | |
| # On production | |
| sudo -u postgres pg_dump database | gzip -9 > database.sql.gz | |
| # On local | |
| scp -C production:~/database.sql.gz | |
| dropdb database && createdb database | |
| gunzip < database.sql.gz | psql database |
| // sbt dependencies: shapeless and org.reflections.reflections | |
| val reflections = new Reflections("org.example") | |
| def findAllObjects[T](cl: Class[T])(implicit t: Typeable[T]): Vector[T] = { | |
| reflections.getSubTypesOf(cl).toVector.flatMap(cl => cl.getField("MODULE$").get(null).cast[T]) | |
| } | |
| findAllObjects(classOf[com.hpn.wms2.core.common.ClientDef]).foreach(println) |
| #!/bin/bash | |
| # .ebextensions/scripts/db_migrate.sh | |
| . /opt/elasticbeanstalk/hooks/common.sh | |
| EB_SUPPORT_FILES=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir) | |
| EB_CONFIG_DOCKER_ENV_ARGS=() | |
| while read -r ENV_VAR; do | |
| EB_CONFIG_DOCKER_ENV_ARGS+=(--env "$ENV_VAR") |
| # output binary | |
| BIN := test | |
| # source files | |
| SRCS := \ | |
| test.cpp | |
| # files included in the tarball generated by 'make dist' (e.g. add LICENSE file) | |
| DISTFILES := $(BIN) |
| resource "aws_iam_instance_profile" "beanstalk_service" { | |
| name = "beanstalk-service-user" | |
| roles = ["${aws_iam_role.beanstalk_service.name}"] | |
| } | |
| resource "aws_iam_instance_profile" "beanstalk_ec2" { | |
| name = "beanstalk-ec2-user" | |
| roles = ["${aws_iam_role.beanstalk_ec2.name}"] | |
| } |