Skip to content

Instantly share code, notes, and snippets.

View Trogious's full-sized avatar

Trog Trogious

View GitHub Profile
@aditya-r-m
aditya-r-m / crgb.cc
Last active July 13, 2024 15:11
Custom Trident Z DRAM RGB Turndown
// Pieces extracted & trimmed from https://gitlab.com/CalcProgrammer1/OpenRGB
// Basic usage : g++ crgb.cc -o ledoff && ./ledoff
// For turning off RAM LEDs at startup : compile in root home directory & add "@reboot /root/ledoff" to "sudo crontab -e"
#include <cstring>
#include <iostream>
#include <linux/i2c-dev.h>
#include <linux/i2c.h>
#include <sys/ioctl.h>
@delivrance
delivrance / ainput.py
Last active June 13, 2024 09:18
Python async input
import asyncio
from concurrent.futures import ThreadPoolExecutor
async def ainput(prompt: str = "") -> str:
with ThreadPoolExecutor(1, "AsyncInput") as executor:
return await asyncio.get_event_loop().run_in_executor(executor, input, prompt)
async def main():
@dpapathanasiou
dpapathanasiou / dst.py
Created August 16, 2014 15:42
How to tell if Daylight Savings Time is in effect using Python
from datetime import datetime
import pytz
def is_dst ():
"""Determine whether or not Daylight Savings Time (DST)
is currently in effect"""
x = datetime(datetime.now().year, 1, 1, 0, 0, 0, tzinfo=pytz.timezone('US/Eastern')) # Jan 1 of this year
y = datetime.now(pytz.timezone('US/Eastern'))
@rduplain
rduplain / MainActivity.java
Created May 8, 2012 20:08
A very simple full-screen WebView activity for Android native wrappers, as a starting point.
package com.willowtreeapps.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {