Skip to content

Instantly share code, notes, and snippets.

View aashutoshrathi's full-sized avatar
👨‍💻
Baking Code

Aashutosh Rathi aashutoshrathi

👨‍💻
Baking Code
View GitHub Profile
@pldespaigne
pldespaigne / eth-tx-hash.ts
Last active March 30, 2024 22:05
Ethereum Tx Hash
import { encode } from '@ethereumjs/rlp';
import { ecrecover } from '@ethereumjs/util';
import { keccak256 } from 'ethereum-cryptography/keccak';
// tx: 0xb00b758da7b97dbeedd1ef62592b2c1427c70ca042dc51a63f3a39d8d31ebbcc
const chainId = 0x1n;
const nonce = 0x3n;
const maxPriorityFeePerGas = 0xf4240n;
const maxFeePerGas = 0x73323c225n;
const gasLimit = 0xdd9cn;
@Dan-Q
Dan-Q / _no_code_page_.php
Last active October 12, 2024 16:49
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@artiebits
artiebits / lpmock.md
Created December 3, 2021 07:35
How to add dummy printer in CUPS

Create a dummy printer:

lpadmin -p myDummyPrinter -E -v file:///dev/null

Make it the default printer:

lpoptions -d myDummyPrinter
@Makeshift
Makeshift / tutorial.md
Last active December 13, 2024 19:11
Tutorial for automatically syncing an Obsidian vault with Git on an Android device

How to sync Obsidian with Git on Android

Limitations

  • If Termux is closed in the background by Android, the cron service will stop updating your repository and you must open Termux again. Refer to instructions for your device model to disable the killing of certain background applications.
  • This may negatively affect your devices battery life. I'm not entirely sure yet.

Setup

@linkdd
linkdd / hackernews-new-comms.js
Last active August 25, 2024 11:15
Add a bell emoji to unread comments on HackerNews
// Can be used with https://github.com/xcv58/Custom-JavaScript-for-Websites-2
// This snippet is released under the terms of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/deed.en
const cache_key = 'hn_comments_views'
const cache = JSON.parse(localStorage.getItem(cache_key) || '{}')
document.querySelectorAll('.athing.comtr').forEach(comm => {
if (!cache[comm.id]) {
const span = document.createElement('span')
span.innerHTML = '&#x1f514;' // :bell: emoji

Color Contribution Graph

canvas

The Github contribution Graph can look a bit too green at times, especially if you're feeling green.
So here is a snippet of code 💛🔷🔻

Light it up 😋

@aleclarson
aleclarson / rollup-typescript.md
Last active November 4, 2024 15:40
The best Rollup config for TypeScript libraries

It's 2024. You should use tsup instead of this.


Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking

@magickatt
magickatt / github_clone_using_token.sh
Created September 6, 2019 17:31
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
@PashCracken
PashCracken / WSL-with-zsh-and-powerlevel9k.png
Last active September 4, 2023 07:28
WSL, zsh and Powerlevel10k
WSL-with-zsh-and-powerlevel9k.png