Skip to content

Instantly share code, notes, and snippets.

View ivmirx's full-sized avatar
☸️
may all living beings be freed from all stress & pain

Ivan Mir ivmirx

☸️
may all living beings be freed from all stress & pain
View GitHub Profile
@ivmirx
ivmirx / mute-mastodon.txt
Last active August 7, 2024 01:28
Filter list for Mastodon, based on mentalhealth.txt by @potatoqualitee
Disclaimer: many of those are extremely important but I believe that social media isn't fit to discuss them
## Politics ##
alt-right
bipartisan
Brexit
Capitol
CCP
China
CIA
@ivmirx
ivmirx / delete-all-messages.js
Created November 9, 2023 19:12 — forked from rcx/delete-all-messages.js
Delete all your messages in a Discord channel
/*
* Discord: Don't copy stuff into this box
* Me: dOn'T COpy sTuFf iNtO tHIs bOx
*/
clearMessages = function (guild_id, author_id, authToken, deleted = new Set()) {
if (guild_id[0] == "_" && guild_id[guild_id.length - 1] == "_") {
alert("Oops! You forgot to set the guild_id. Please fill it in.")
return;
}
if (author_id[0] == "_" && author_id[author_id.length - 1] == "_") {
@ivmirx
ivmirx / SilentSwitch.cs
Last active April 30, 2021 00:42
Detecting when sound is muted with the silent switch on iPhone or iPad for .NET & Xamarin. Useful for text-to-speech because it does not work when a device is in silent mode. Based on https://github.com/moshegottlieb/SoundSwitch
// since there is no API for checking if the silent mode is on, the trick is to play a 50ms silent system sound
// if it takes just a few milliseconds, it means the sound wasn't allowed to play and the silent mode is on
using System;
using Foundation;
using AudioToolbox;
using System.Threading.Tasks;
public class SilentSwitch
{
@ivmirx
ivmirx / xcode.xml
Created December 28, 2020 14:00
Key bindings to duplicate and delete lines in Xcode
<!--
Nowadays Xcode has a "Delete Line" key binding, but it jumps to the beginning of the next line after deletion.
The custom one jumps to the end of the next line.
Custom key bindings have to be added after every Xcode update.
Open the following file with any text editor:
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
…and insert the following:
-->
@ivmirx
ivmirx / platforms.js
Created November 28, 2020 00:54
Detect the most common platforms, including ipadOS
var is_windows = navigator.platform.indexOf('Mac') > -1;
var is_macOS = false;
var is_ipadOS = false;
var is_iOS = /(iPhone|iPod)/i.test(navigator.platform);
var is_Android = navigator.platform.indexOf('Android') > -1;
var is_Linux = navigator.platform.indexOf('Linux') > -1;
if (navigator.platform.indexOf('Mac') > -1) {
if (navigator.maxTouchPoints > 1)
is_ipadOS = true
@ivmirx
ivmirx / MvxBottomNavigationItemChangedBinding.cs
Last active June 25, 2022 14:09
Using the new Android's BottomNavigationView with MvvmCross 6
// a custom binding for Droid to get "app:MvxBind" in root_view working
using System;
using Android.Support.Design.Widget;
using MvvmCross.Binding;
using MvvmCross.Commands;
using MvvmCross.Platforms.Android.Binding.Target;
namespace YourApp.Droid.Bindings
{
@ivmirx
ivmirx / filter.js
Last active June 16, 2024 18:03
Filter for hckrnews.com (Chromium and Firefox extension)
var words = [
'php', 'js', 'css', 'html', 'java', 'ruby', 'rust', 'golang', 'kotlin', 'perl',
'elixir', 'elm ', 'erlang', 'clojure', 'lisp', 'racket', 'scala',
'mozilla', 'firefox', 'mysql', 'mongo', 'latex', 'webgl',
'kubernetes', 'docker', 'tensor', 'graphql', ' ml ', 'machine learning', 'artificial intelligence', 'ai ',
'google', 'facebook', 'amazon', 'aws ', 'dell', 'amd', 'verizon', 'airbnb', 'uber', 'tesla', 'spacex', 'self-driving',
'fundraising', 'investor', 'venture', 'unicorn', 'billionaire', 'musk', 'bezos', 'bill gates',
'bitcoin', 'btc', 'ethereum', 'blockchain', 'cryptocurrenc',
'francisco', 'new york', 'california', 'bay area', 'texas', 'florida', 'wall street',
'politics', 'u.s.', 'white house', 'federal', 'president', 'congress', 'senate', 'scotus', 'court', 'police', 'military', 'fbi', 'cia', 'nsa', 'immigration', 'democracy', 'election', 'mayor', 'trump', 'biden',