Skip to content

Instantly share code, notes, and snippets.

View njpatel's full-sized avatar
📞
Were you really going to call me?

Neil Jagdish Patel njpatel

📞
Were you really going to call me?
View GitHub Profile
@rcarmo
rcarmo / automator.py
Last active July 8, 2024 13:56
macOS Services in the style of NotesOllama
# Drop this into Automator using Python 3 as the shell
from sys import stdin
from json import dumps, loads
from urllib.parse import urlencode
from urllib.request import Request, urlopen
AZURE_ENDPOINT="getyourowndeployment.openai.azure.com"
OPENAI_API_KEY="getyourownkey"
OPENAI_API_VERSION="2023-05-15"
@stuartlangridge
stuartlangridge / firehose.py
Created July 6, 2023 19:16
Python file to read the Bluesky ("atproto") firehose and show the json of each message. (Doesn't contain the author, because who knows how the hell to do that.)
from atproto.firehose import FirehoseSubscribeReposClient, parse_subscribe_repos_message
import sys
from atproto import CAR, models
from atproto.cbor import decode_dag, decode_dag_multi
from atproto.xrpc_client.models.utils import get_or_create
import json
class JSONExtra(json.JSONEncoder):
"""raw objects sometimes contain CID() objects, which
seem to be references to something elsewhere in bluesky.
@MihailCosmin
MihailCosmin / cuda_11.8_installation_on_Ubuntu_22.04
Last active July 14, 2024 07:39 — forked from primus852/cuda_11.7_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@ryo-ARAKI
ryo-ARAKI / starship.toml
Last active July 24, 2024 09:07
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"
[[battery.display]]
threshold = 30
style = "bold red"
public override void OnActivated (UIApplication application)
{
//When your app is backgrounded, iOS takes a snapshot.
//When the app comes back from the background it shows this snapshot at launch until your app is ready
//Sometimes apple forgets to remove the splash screen.
//Your app is in the forground and working. To prove it you can rotate, and see half your real screen.
//To prevent this from happening you can manually remove the view
foreach (var w in application.Windows) {
if (w != null && w != window) {
@jspahrsummers
jspahrsummers / GHRunLoopWatchdog.h
Created January 28, 2015 20:50
A class for logging excessive blocking on the main thread
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@bradp
bradp / setup.sh
Last active July 24, 2024 15:55
New Mac Setup Script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github \n"
echo "https://github.com/account/ssh \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@bluemalkin
bluemalkin / terraform-2tier-vpc
Last active November 16, 2019 04:22
Terraform 2 tier VPC with nat
# define some variables
variable "aws_ubuntu_ami" {
default = "ami-972444ad"
}
variable "aws_keypair" {
default = "xxxx"
}
# AWS account details
@alganet
alganet / exists.cmd
Last active November 19, 2018 14:21
sh/bat hybrid that checks available commands. Despite its hackish look, it was tested under Windows XP, wine, ksh, zsh, dash and bash.
: ::\
@echo off
rem () ( command -v $1 >/dev/null 2>&1; return $? )
rem : "Usage sh: $ sh exists.cmd ls && echo exists "
rem : "Usage bat: > exists.cmd notepad "
rem : " > echo %ErrorLevel% "
rem $1 <<REM
:exists