Skip to content

Instantly share code, notes, and snippets.

View bermanboris's full-sized avatar
🎯
Hyper Focusing

Boris Berman bermanboris

🎯
Hyper Focusing
  • Earth
View GitHub Profile
@lordneon
lordneon / esp8266.py
Created October 29, 2018 20:55
Parses ESP8266 firmware blobs in IDA. Drop this file into the loaders directory.
#!/usr/bin/python
# esptool imports
from __future__ import division, print_function
import argparse
import base64
import binascii
import copy
import hashlib
@christiannaths
christiannaths / webpack-symlink-trick.md
Last active October 8, 2017 19:59
Webpack: avoid relative import paths by symlinking a shortcut
@mnn
mnn / JoiFromTypeScript.hs
Created January 20, 2017 12:34
JoiFromTypeScript - Converts TypeScript interface and type statements to Joi schema generators.
#!/usr/bin/env runhaskell
{-|
Module : JoiFromTypeScript
Description : Converts TypeScript interface and type statements to Joi schema generators.
Copyright : monnef
Maintainer : monnef2@gmail.com
Stability : experimental
= Dependencies
function translateError(msg) {
var newErr = new Error(msg); // placed here to get correct stack
return e => {
newErr.originalError = e;
throw newErr;
}
}
async function asyncTask() {
const user = await UserModel.findById(1).catch(translateError('No user found'))
@yetanotherchris
yetanotherchris / install-rabbitmq.sh
Last active April 29, 2023 07:10
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
@bithavoc
bithavoc / postgres-notify-trigger.sql
Last active February 2, 2019 09:31
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@iammerrick
iammerrick / LazilyLoad.js
Last active August 7, 2019 14:15
Lazily Load Code Declaratively in React + Webpack
import React from 'react';
const toPromise = (load) => (new Promise((resolve) => (
load(resolve)
)));
class LazilyLoad extends React.Component {
constructor() {
super(...arguments);
@samuelluis
samuelluis / object-watch.js
Last active August 26, 2016 23:45 — forked from eligrey/object-watch.js
object.watch polyfill in ES5
if (!Object.prototype.typeof) {
Object.defineProperty(Object.prototype, "typeof", {
enumerable: false
, configurable: true
, writable: false
, value: function (Type) {
toString = Object.prototype.toString;
return toString.call(this) == toString.call(new Type());
}
});