Skip to content

Instantly share code, notes, and snippets.

@coltonbh
coltonbh / docker-swarm-gpu.md
Last active April 26, 2024 09:28
Docker Swarm GPU Support

GPU Support For Docker Swarm

Docker compose has nice support for GPUs, K8s has moved their cluster-wide GPU scheduler from experimental to stable status. Docker swarm has yet to support the device option used in docker compose so the mechanisms for supporting GPUs on swarm are a bit more open-ended.

Basic documentation

@mensonones
mensonones / TouchableWithoutFeedback.js
Last active April 26, 2024 09:27
Added prop style for component TouchableWithoutFeedback (React Native 0.74) Path: node_modules/react-native/Libraries/Components/Touchable/TouchableWithoutFeedback.js
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
@claus
claus / _app.js
Created May 14, 2020 05:35
Restore scroll position after navigating via browser back/forward buttons in Next.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
useScrollRestoration(router);
return <Component {...pageProps} />;
};
export default App;
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active April 26, 2024 09:25
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@marcorieser
marcorieser / Format Antlers, Blade, Vue, Tailwind and PHP with Prettier in PhpStorm.md
Last active April 26, 2024 09:24
Format Antlers, Blade, Vue, Tailwind and PHP with Prettier in PhpStorm

Install dependencies

Run npm install -D prettier prettier-plugin-antlers prettier-plugin-blade prettier-plugin-tailwindcss @prettier/plugin-php in your terminal

Configure prettier

Create a .prettierrc file with the following content

{
  "singleQuote": true,
  "trailingComma": "all",
  "printWidth": 140,
@ronascentes
ronascentes / Install-SqlServerPSModule.ps1
Last active April 26, 2024 09:24
Install SqlServer Powershell module to a machine without access to PowerShell Gallery
# download the module to local folder
Invoke-WebRequest -Uri powershellgallery.com/api/v2/package/sqlserver -Out C:\temp\sqlserver.zip
# unzip the file
Expand-Archive -LiteralPath 'C:\temp\sqlserver.zip' -DestinationPath C:\temp\sqlserver
# remove powershell gallery related files
Push-Location C:\temp\sqlserver
Remove-Item .\_rels\ -Recurse -Force
Remove-Item .\package\ -Recurse -Force
@svoisen
svoisen / Of Mice and Men
Created March 21, 2013 19:16
Information on low-level scrolling events on Mac OS X
From the WebKit documentation at:
http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/chromium/src/mac/WebInputEventFactory.mm
// Of Mice and Men
// ---------------
//
// There are three types of scroll data available on a scroll wheel CGEvent.
// Apple's documentation ([1]) is rather vague in their differences, and not
// terribly helpful in deciding which to use. This is what's really going on.
//
@cvoltz
cvoltz / dropbox.patch
Created August 9, 2019 14:54
Patch to dropbox.py to get the correct PID when running Dropbox via flatpak
--- dropbox.py
+++ dropbox.py
@@ -134,11 +134,12 @@
FatalVisibleError("Platform not supported")
def is_dropbox_running():
- pidfile = os.path.expanduser("~/.dropbox/dropbox.pid")
-
try:
- with open(pidfile, "r") as f:
@osipxd
osipxd / paper-versions.json
Last active April 26, 2024 09:23
Paper versions links
{
"latest": "1.20.4",
"versions": {
"1.20.4": "https://api.papermc.io/v2/projects/paper/versions/1.20.4/builds/484/downloads/paper-1.20.4-484.jar",
"1.20.2": "https://api.papermc.io/v2/projects/paper/versions/1.20.2/builds/318/downloads/paper-1.20.2-318.jar",
"1.20.1": "https://api.papermc.io/v2/projects/paper/versions/1.20.1/builds/196/downloads/paper-1.20.1-196.jar",
"1.20": "https://api.papermc.io/v2/projects/paper/versions/1.20/builds/17/downloads/paper-1.20-17.jar",
"1.19.4": "https://api.papermc.io/v2/projects/paper/versions/1.19.4/builds/550/downloads/paper-1.19.4-550.jar",
"1.19.3": "https://api.papermc.io/v2/projects/paper/versions/1.19.3/builds/448/downloads/paper-1.19.3-448.jar",
"1.19.2": "https://api.papermc.io/v2/projects/paper/versions/1.19.2/builds/307/downloads/paper-1.19.2-307.jar",