Skip to content

Instantly share code, notes, and snippets.

@anujbiyani
anujbiyani / ensure_stable_schema_migrations.rb
Last active April 16, 2024 23:04
A script to make sure new Rails migrations cleanly migrate forwards and backwards.
#!/usr/bin/env ruby
require "pathname"
common_ancestor_sha = `git merge-base HEAD origin/master`.strip
commit_messages = `git log --pretty=format:"%B" #{common_ancestor_sha}..HEAD`
if commit_messages.include?("[skip schema checks]")
puts "Found [skip schema checks] tag, skipping db migration check."
exit
@alucard001
alucard001 / Dockerfile
Last active April 16, 2024 22:58
Docker + Laravel + Nginx + Swoole Reverse Proxy Setup
FROM php_base:latest
RUN apt update -y && apt upgrade -y
WORKDIR /var/www/html
RUN composer update --optimize-autoloader
COPY src/. /var/www/html
COPY build/php/.env.local /var/www/html/.env
@qoomon
qoomon / conventional_commit_messages.md
Last active April 16, 2024 22:58
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

Logseq Plugin Setup Guide

[WIP] Logseq Plugin System is currently under Alpha Testing phase.

For Developers

In this short guide, it will walk you through the steps needed to set up your development environment for writing and running a hello world simple inside of Logseq Desktop Client. You know Logseq Plugin based on Web Technologies composed of JS & HTML & CSS, but neither are mandatory, you can develop plugins use any language which can be translated to javascript (Logseq made by Clojurescript!). We will use Typescript to demonstrate this sample. Because there is a type definition file to make development experience even better.

Install Node.js and NPM

Welcome to a simple guide on setting up the Chromium browser with Flash support on Linux.

  1. Download Chromium:

    Begin by downloading an old version of Ungoogled Chromium from a trusted source. You can grab the version that I am using here. Alternatively, if you prefer, you can select a different version from the ungoogled chromium archive. Once downloaded, extract the files to a location of your choice. For instance, you could extract it to /home/<yourname>/Applications/chromium-linux/.

  2. Download Flash Player:

    Download the Flash Player plugin from this link. Extract the libpepflashplayer.so file from the downloaded archive.

@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@goo99x
goo99x / ResizeEnums.py
Created April 5, 2023 16:03
Ghidra script to recursively resize enums given a top-level data type to their minimal packed form.
# Recursively resize enums given a top-level data type to their minimal packed form.
#
# When enum types are imported into Ghidra, they are assumed to be 4-bytes in width.
# This script will adjust the size of the imported enums to their packed bitwidth,
# which is the smallest bitwidth that can accurately represent all possible enumerator values.
#
#@author goo99x
#@category Data Types
import math
@anvk
anvk / psql_useful_stat_queries.sql
Last active April 16, 2024 22:45
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@MawKKe
MawKKe / cryptsetup-with-luks2-and-integrity-demo.sh
Last active April 16, 2024 22:44
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) ekkwam@gmail.com
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 16, 2024 22:44
Useful PostgreSQL Queries and Commands
-- 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%'