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
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@phrawzty
phrawzty / 2serv.py
Last active May 31, 2024 17:14
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
@limingjie
limingjie / terminalcolors.py
Last active November 29, 2023 06:03
check if terminal supports 256 colors
#!/usr/bin/env python
# Copyright (C) 2006 by Johannes Zellner, <johannes@zellner.org>
# modified by mac@calmar.ws to fit my output needs
# modified by crncosta@carloscosta.org to fit my output needs
# Original source: https://github.com/incitat/eran-dotfiles/blob/master/bin/terminalcolors.py
import sys
import os
@limingjie
limingjie / 256 colors.md
Last active April 24, 2024 22:15
256 colors in putty, tmux/screen and vim

#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.

  • putty

    Set Connection -> Data -> Terminal-type string to xterm-256color

  • tmux

Add this line to ~/.tmux.conf

@ridencww
ridencww / SerialPrintf.txt
Last active June 12, 2023 19:12
Basic printf functionality for the Arduino serial ports
/*
* Simple printf for writing to an Arduino serial port. Allows specifying Serial..Serial3.
*
* const HardwareSerial&, the serial port to use (Serial..Serial3)
* const char* fmt, the formatting string followed by the data to be formatted
*
* int d = 65;
* float f = 123.4567;
* char* str = "Hello";
* serial_printf(Serial, "<fmt>", d);
@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
@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;
@dmfigol
dmfigol / asyncio_loop_in_thread.py
Last active May 28, 2024 20:13
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
@andersevenrud
andersevenrud / alacritty-tmux-vim_truecolor.md
Last active June 8, 2024 18:48
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
@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.