Skip to content

Instantly share code, notes, and snippets.

View scalp42's full-sized avatar
🪂

Anthony Scalisi scalp42

🪂
View GitHub Profile
@athyuttamre
athyuttamre / ip.py
Last active January 27, 2024 01:19
import requests
import json
import csv
import sys
KEY = "1dd922548150f47ec2980e90b659b793"
BULK = False
# One-by-one
def map_ip_to_location(ip):
@gottfrois
gottfrois / Dockerfile
Created September 6, 2018 09:06
medium-multi-stage-dockerfile-final-dockerfile
###############################
# Stage wkhtmltopdf
FROM madnight/docker-alpine-wkhtmltopdf as wkhtmltopdf
######################
# Stage: ruby
FROM ruby:2.5.1-alpine3.7 as ruby
LABEL description="Base ruby image used by other stages"
######################
@swalkinshaw
swalkinshaw / tutorial.md
Last active July 20, 2025 07:39
Designing a GraphQL API

About the pic

Choria supports Federating multiple collectives of nodes into a large Federated collective for the purpose of orchestrating.

Federation Requests have:

  • A orchestration request as normal
  • Special headers listing which nodes its for

The client chops a large request into bundles of 200 nodes and publish them to the network for federation. Multiple federation brokers can thus take care of distributing it.

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active October 15, 2025 20:00
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@AtulKsol
AtulKsol / db_backup_commands.md
Last active December 28, 2024 02:23
Commands to backup & restore database
  1. pg_dump is a nifty utility designed to output a series of SQL statements that describes the schema and data of your database. You can control what goes into your backup by using additional flags.
    Backup: pg_dump -h localhost -p 5432 -U postgres -d mydb > backup.sql

    Restore: psql -h localhost -p 5432 -U postgres -d mydb < backup.sql

    -h is for host.
    -p is for port.
    -U is for username.
    -d is for database.

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
@matsukaz
matsukaz / application.rb
Last active May 13, 2025 06:14
Rails connection management to handle Amazon Aurora's failover
module xxx
class Application < Rails::Application
#(中略)
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement,
'ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement'
end
end
@Spaider
Spaider / envelope_encryption_kms_boto_pycrypto.md
Last active December 12, 2023 23:59 — forked from pmp/envelope_encryption_kms_boto_pycrypto.md
Envelope Encryption using AWS KMS, Python Boto, and PyCrypto.

If you use Amazon AWS for nearly anything, then you are probably familiar with KMS, the Amazon Key Management Service.

KMS is a service which allows API-level access to cryptographic primitives without the expense and complexity of a full-fledged HSM or CloudHSM implementation. There are trade-offs in that the key material does reside on servers rather than tamper-proof devices, but these risks should be acceptable to a wide range of customers based on the care Amazon has put into the product. You should perform your own diligence on whether KMS is appropriate for your environment. If the security profile is not adequate, you should consider a stronger product such as CloudHSM or managing your own HSM solutions.

The goal here is to provide some introductory code on how to perform envelope encrypt a message using the AWS KMS API.

KMS allows you to encrypt messages of up to 4kb in size directly using the encrypt()/decrypt() API. To exceed these limitations, you must use a technique called "envelope encryptio

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active October 10, 2025 13:30
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux