Skip to content

Instantly share code, notes, and snippets.

@amosbastian
amosbastian / route.ts
Last active May 1, 2024 14:43
Lemon Squeezy webhook using the new route handler in Next.js 13
import crypto from "crypto";
import { listAllSubscriptions } from "lemonsqueezy.ts";
import { NextRequest } from "next/server";
// Put this in your billing lib and just import the type instead
type LemonsqueezySubscription = Awaited<ReturnType<typeof listAllSubscriptions>>["data"][number];
const isError = (error: unknown): error is Error => {
return error instanceof Error;
};
@EnismanY
EnismanY / linux_wifi.md
Last active May 1, 2024 14:43
Linux WiFi from the command line

Network speed, signal strength and specifying the band

Identify network interfaces

ifconfig -a

or:

ip a
@shinzui
shinzui / tmux.conf
Created March 12, 2011 01:08 — forked from bryanl/tmux.conf
tmux.conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@flaksp
flaksp / README.md
Last active May 1, 2024 14:43
Convert BitWarden JSON export file to Apple iCloud Keychain CSV import file saving TOTP and notes

BitWarden to Apple iCloud Keychain passwords converter

This Python scripts allows you to move your passwords from BitWarden to Apple iCloud.

You need to know:

  • It ignores secure notes, credit cards and other types that are not passwords.
  • It ignores BitWarden entries without usernames, passwords and URLs.
  • It also ignores URLs that do not start with http:// or https://.
  • It normalizes all TOTP tokens, e.g. wskg vtqa h5kl bhb4 v4v2 ybyo woc6 qme2 will be converted to otpauth://totp/example.com:dude@foo.bar?secret=WSKGVTQAH5KLBHB4V4V2YBYOWOC6QME2&amp;issuer=example.com&amp;algorithm=SHA1&amp;digits=6&amp;period=30.
@jgamblin
jgamblin / urls.txt
Created July 6, 2016 12:00
Top 1000 Domains
google.com
youtube.com
facebook.com
baidu.com
yahoo.com
amazon.com
wikipedia.org
google.co.in
twitter.com
qq.com
@tzmartin
tzmartin / embedded-file-viewer.md
Last active May 1, 2024 14:41
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@pedramamini
pedramamini / XProtect.yara
Created October 19, 2017 20:18
Apple OSX built in file defense is powered by YARA: /System/Library/CoreServices/XProtect.bundle/Contents/Resources
import "hash"
private rule Macho
{
meta:
description = "private rule to match Mach-O binaries"
condition:
uint32(0) == 0xfeedface or uint32(0) == 0xcefaedfe or uint32(0) == 0xfeedfacf or uint32(0) == 0xcffaedfe or uint32(0) == 0xcafebabe or uint32(0) == 0xbebafeca
}
@the-nose-knows
the-nose-knows / csharp_7point1orlater_asyncmain_countdowntimer.cs
Last active May 1, 2024 14:38
A countdown timer written in C# 7.1+ using an async main method and an async task delay
using System;
using System.Threading.Tasks;
namespace CountdownTimer
{
class Program
{
public static async Task Main( string[] args )
{
int delay = 500; // Default delay
@chranderson
chranderson / nvmCommands.js
Last active May 1, 2024 14:36
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@lasagnaphil
lasagnaphil / build_libtorch.sh
Last active May 1, 2024 14:36
Build libtorch from scratch
# Script for installing libtorch from scratch (without any python dependencies)
# This clones the ``pytorch`` folder in the current directory, creates a ``pytorch-build`` directory containing all the intermediate files for building, and creates a ``pytorch-install`` folder for storing the compiled library.
# After the build, you can use it by setting ``CMAKE_PREFIX_PATH=(path to pytorch-install folder)``.
# Note that you need to have all the dependencies needed before running this script! (Read README.md in the main pytorch repo)
git clone --recursive https://github.com/pytorch/pytorch -b v1.7.1 --depth 1
mkdir -p pytorch-build
mkdir -p pytorch-install
pushd pytorch-build