Skip to content

Instantly share code, notes, and snippets.

@m5r
m5r / index.tsx
Created February 26, 2022 20:22
bullmq job queue in Remix
import notifierQueue from "~/queues/notifier.server.ts";
export const loader = async () => {
await notifierQueue.add("test", { emailAddress: "mokhtar@remixtape.dev" });
return null;
};
@haranjackson
haranjackson / chrome_headless.py
Last active January 25, 2024 00:31
Deploys the Python Selenium library and Chrome Headless to an AWS Lambda layer. You can specify the region, library version, and runtime. An example Lambda function is given.
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = '/opt/headless-chromium'
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--start-maximized')
options.add_argument('--start-fullscreen')
@miguelmota
miguelmota / pubsub.go
Created October 6, 2018 21:12
Golang redis pub/sub example
package pubsub
import (
"github.com/garyburd/redigo/redis"
log "github.com/sirupsen/logrus"
)
// Service service
type Service struct {
pool *redis.Pool
@DonDebonair
DonDebonair / MockHBaseConnection.java
Last active September 6, 2020 06:12 — forked from agaoglu/MockHTable.java
MockHBaseTable & MockHBaseConnection
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
/**
@EvAlex
EvAlex / git-squash-merge.sh
Created July 8, 2017 06:49
Shell script to perform git feature branch merge with squash preserving author
#!/bin/bash
set -e
function select_branch() {
echo "Not merged branches on origin:"
branches=`git branch --list -r --no-merged`
IFS=$'\n' read -d '' -r -a branches_arr <<< "$branches" || true # dunno why, IFS raises error code
if [ ${#branches_arr[@]} -eq 0 ]; then
echo "\e[93mNo unmerged remote branches found\e[0m"
exit
@dankrause
dankrause / postgresql_recursive.sql
Last active February 26, 2024 16:03
An example of creating a recursive postgresql query to generate data about parent-child relationships within a single table.
CREATE TABLE test
(
id INTEGER,
parent INTEGER
);
INSERT INTO test (id, parent) VALUES
(1, NULL),
(2, 1),
"""
Copy objects from one bucket/prefix to another bucket with the same prefix.
Used to allow CloudFront logs to get parsed for uploading to ES *AND* analyzed
by WAF.
CloudFront Distribution logs -> s3://es-bucket/incoming -> Lambda (this) -> s3://waf-bucket/
Set environment variable `destination_bucket`
@joyrexus
joyrexus / install.py
Last active September 26, 2020 05:55
Shopify App Installation URL via AWS Lambda (Python)
# https://help.shopify.com/api/guides/authentication/oauth#scopes
scopes = []
scopes.append('read_content')
scopes.append('write_content')
scopes.append('read_themes')
scopes.append('write_themes')
scopes.append('read_products')
scopes.append('write_products')
scopes.append('read_customers')
@awanabe
awanabe / BaseSpiderClass.py
Last active March 11, 2018 15:36
爬虫基类
# coding=utf-8
import time
from datetime import datetime
from threading import Thread
from redis import StrictRedis
from redis.exceptions import ConnectionError
@subfuzion
subfuzion / curl.md
Last active May 16, 2024 18:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.