Skip to content

Instantly share code, notes, and snippets.

View rob4226's full-sized avatar
💭
Working on ESP32 Projects

Rob rob4226

💭
Working on ESP32 Projects
View GitHub Profile
@Windows81
Windows81 / extension.bundle.js
Last active March 25, 2024 01:24
Pylance 2024.2.103 is officially compatible with Codium! F*** coPyrights!
/*var getStackTrace = function () {
var obj = {};
Error.captureStackTrace(obj, getStackTrace);
return obj.stack;
};*/
function a0_0x2022(_0xcf00d8, _0x46623d) {
const _0xf90af8 = a0_0xf90a();
return (
(a0_0x2022 = function (_0x2022ef, _0xef2f2) {
@MarkusH
MarkusH / serial-to-identity.sql
Last active April 25, 2024 12:26
A script that outputs the raw SQL to convert Django's serial columns to identity columns.
WITH tab AS (
SELECT
a.attrelid::regclass::text AS t,
a.attname AS c,
pg_get_serial_sequence(a.attrelid::regclass::text, a.attname) AS s,
nextval(pg_get_serial_sequence(a.attrelid::regclass::text, a.attname)) AS v
FROM pg_attribute a
JOIN pg_class c ON c.oid = a.attrelid
WHERE
a.attrelid::regclass::text LIKE '%'
@laroo
laroo / NMEA_NEO-6M.txt
Created March 15, 2023 23:56
NMEA commands for u-blox NEO-6M gps receiver
# Disabling all NMEA sentences
$PUBX,40,GGA,0,0,0,0*5A // Disable GGA
$PUBX,40,GLL,0,0,0,0*5C // Disable GLL
$PUBX,40,GSA,0,0,0,0*4E // Disable GSA
$PUBX,40,GSV,0,0,0,0*59 // Disable GSV
$PUBX,40,RMC,0,0,0,0*47 // Disable RMC
$PUBX,40,VTG,0,0,0,0*5E // Disable VTG
$PUBX,40,ZDA,0,0,0,0*44 // Disable ZDA
# Enabling all NMEA sentences
@kakha13
kakha13 / SMART_BANNER_height
Last active July 16, 2021 23:28
How to get nativescript-plugin-firebase admob SMART_BANNER height
First we are getting screen size and then doing calculations with SMART_BANNER logics
const platform = require("platform") // import this
......
const screenHeightDp =platform.screen.mainScreen.heightPixels / platform.screen.mainScreen.scale; // height divided by scale
const BannerHeight = screenHeightDp > 720 ? 90 : screenHeightDp > 400 ? 50 : 32; // doing calculations as smart banner works
console.log(BannerHeight); // this is our banner height
@mss
mss / ifupdown-to-netplan.txt
Last active May 7, 2024 18:06
Migrate from ifupdown to netplan
# Tested on an upgraded Ubuntu 20.04
apt install netplan.io
systemctl unmask systemd-networkd.service
systemctl unmask systemd-resolved.service
ENABLE_TEST_COMMANDS=1 netplan migrate
netplan try
reboot
apt purge ifupdown resolvconf
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
@kieranb662
kieranb662 / XcodeKitHelpers.md
Last active April 6, 2023 15:44
[Xcode Editor Notes] Xcodekit Extensions to help make Xcode your own custom text editor.

Xcode Editor Notes

Suggestions

After adding the Extension target to a project

  1. Go to the menu bar -> Product -> Scheme -> Edit Scheme.
  2. Under the info tab change the executable dropdown menu to "Xcode.app".
  3. If you have a testing file add it to the "Arguments Passed On Launch" field under the Arguments tab.
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active May 18, 2024 04:16
True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

True Color (24-bit) and italics with alacritty + tmux + vim (neovim)

This should make True Color (24-bit) and italics work in your tmux session and vim/neovim when using Alacritty (and should be compatible with any other terminal emulator, including Kitty).

Testing colors

Running this script should look the same in tmux as without.

curl -s https://gist.githubusercontent.com/lifepillar/09a44b8cf0f9397465614e622979107f/raw/24-bit-color.sh >24-bit-color.sh
@dmfigol
dmfigol / asyncio_loop_in_thread.py
Last active April 21, 2024 17:32
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable
@yceruto
yceruto / FilesystemCacheWarmer.php
Last active September 26, 2022 08:46
Twig filesystem cache warmer
<?php
use Symfony\Component\Finder\Finder;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
class FilesystemCacheWarmer
{
private $twig;
@sylvainpelissier
sylvainpelissier / pyuac.py
Last active March 20, 2023 23:28 — forked from Preston-Landers/pyuac.py
pyuac - elevate a Python process with UAC on Windows compatible Python 3.
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vim: fileencoding=utf-8 tabstop=4 expandtab shiftwidth=4
"""User Access Control for Microsoft Windows Vista and higher. This is
only for the Windows platform.
This will relaunch either the current script - with all the same command
line parameters - or else you can provide a different script/program to
run. If the current user doesn't normally have admin rights, he'll be