Skip to content

Instantly share code, notes, and snippets.

View rsarai's full-sized avatar
🏜️

Rebeca Sarai rsarai

🏜️
View GitHub Profile
@dabit3
dabit3 / connectweb3wallet.js
Created December 1, 2021 16:19
Connecting a web3 wallet
import { ethers } from 'ethers'
import Web3Modal from 'web3modal'
import WalletConnectProvider from '@walletconnect/web3-provider'
async function getWeb3Modal() {
const web3Modal = new Web3Modal({
network: 'mainnet',
cacheProvider: false,
providerOptions: {
walletconnect: {
@seddonym
seddonym / durability.py
Last active September 13, 2024 09:24
Durable decorator
import functools
from django.conf import settings
from django.db import transaction, utils
def durable(func):
"""
Decorator to ensure that a function is not being called within an atomic block.

Code Review

Polyglot Unconference 2018

John, from Mobify kickoff presentation

Initial cofounder of mobify, did a lot of early development, solo. Added more developers to the team, got more experience looking at others' code. Learned a lot of things by looking at others' code. As code review policy brought in, junior developers picked stuff up faster.

@borgstrom
borgstrom / human_time_duration.py
Created May 9, 2018 04:00
Python: Convert seconds (duration) to human readable string
TIME_DURATION_UNITS = (
('week', 60*60*24*7),
('day', 60*60*24),
('hour', 60*60),
('min', 60),
('sec', 1)
)
def human_time_duration(seconds):
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@pioug
pioug / index.js
Last active May 2, 2024 10:23
Errors to ignore on Sentry, likely caused by browsers/extensions/webviews
const ignoreErrors = [
/^No error$/,
/__show__deepen/,
/_avast_submit/,
/Access is denied/,
/anonymous function: captureException/,
/Blocked a frame with origin/,
/can't redefine non-configurable property "userAgent"/,
/change_ua/,
/console is not defined/,
@naesheim
naesheim / buildWhenAffected.sh
Last active November 28, 2022 20:20
CircleCi - only build features that has changed
##################
### config.yml ###
##################
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
steps:
@agilepoodle
agilepoodle / mount-encrypted-partition-fedora-live-usb.sh
Created June 21, 2017 19:15
When you need to access LUKS encrypted partition with a Fedora Live CD or USB
# make sure crypt module in use
sudo modprobe dm-crypt
# Find out which drive it was with the following command:
sudo fdisk -l
# You must mount /dev/sda3 myvolume
# use cryptsetup, device is accessible under /dev/mapper/myvolume
sudo cryptsetup luksOpen /dev/sde3 myvolume
@geek-id
geek-id / Problem Solving
Last active December 3, 2018 16:25
Problem Solving in Linux
[error]
ImportError: No module named '_gdbm'
[solved]
sudo apt-get install python3.5-gdbm
[error]
ImportError: No module named 'apt_pkg'
[solved]
locate apt_pkg.so
sudo ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so /usr/lib/python3/dist-packages/apt_pkg.so