Skip to content

Instantly share code, notes, and snippets.

View valyagolev's full-sized avatar
💭
hey there! i'm using github

Valentin Golev valyagolev

💭
hey there! i'm using github
View GitHub Profile
@valyagolev
valyagolev / main.rs
Last active December 14, 2023 17:07
using Schedule labels with custom app states
use bevy::prelude::*;
use states::AppUpdate;
mod prelude;
mod states;
use prelude::*;
fn in_menu(mouse: Res<Input<MouseButton>>, mut next: ResMut<NextState<states::AppState>>) {
println!("in_menu");
use std::{mem::ManuallyDrop, time::Duration};
use dioxus::prelude::Scope;
use tokio::sync::oneshot::{self, Sender};
pub struct PeriodicUpdateSub {
sender: ManuallyDrop<Sender<()>>,
}
impl Drop for PeriodicUpdateSub {
@valyagolev
valyagolev / uiatom.rs
Created May 28, 2023 01:49
bi-directional comm between dioxus and the outside
use std::{
mem::ManuallyDrop,
ops::{Deref, DerefMut},
sync::{Arc, Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard},
};
use dioxus::prelude::Scope;
pub struct UiAtomSubscription<T> {
atom: Arc<UiAtom<T>>,
@valyagolev
valyagolev / keybase.md
Created May 21, 2023 15:34
keybase.md

Keybase proof

I hereby claim:

  • I am valyagolev on github.
  • I am valyagolev (https://keybase.io/valyagolev) on keybase.
  • I have a public key ASCq6yAJ9YhrIDZ2uLU6ev0nQfxbRI8KTpYmiBcPV2WjrAo

To claim this, I am signing this object:

@valyagolev
valyagolev / notbook.ipynb
Created December 2, 2019 03:05
the code to generate swatch telegram sticker pack from your own set of colors
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@valyagolev
valyagolev / datadog_upstart_check.py
Last active August 29, 2015 14:22
datadog check for upstart, foreman-exported jobs
"""
Sends metrics about running Foreman-type jobs exported in Upstart
1. Put it into /etc/dd-agent/conf.d/datadog_upstart_check.py
2. Create /etc/dd-agent/conf.d/datadog_upstart_check.yaml
init_config:
instances:
- prefix: 'an-app'
@valyagolev
valyagolev / any.html
Last active December 11, 2015 22:29
Demonstrative code snippets for Uploadcare
<!-- The best place for these is your <HEAD> tag -->
<script async="async"
src="https://ucarecdn.com/widget/0.6.0/uploadcare/uploadcare-0.6.0.min.js">
</script>
<script>UPLOADCARE_PUBLIC_KEY = "demopublickey";</script>
<!-- This is where the widget will be. Don't forget the name attribute! -->
<input type="hidden" role="uploadcare-uploader" name="my_file" />
<!-- That's all! -->
@valyagolev
valyagolev / fabfile.py
Created June 2, 2012 20:20
Quick deploy with chef-solo and fabric
# http://unfoldthat.com/2012/06/02/quick-deploy-chef-solo-fabric.html
from fabric.api import settings, run, sudo, reboot, put, cd, env
AWS_ACCESS_KEY = '...'
AWS_SECRET_KEY = '...'
AWS_KEYPAIR_NAME = '...'
AWS_SECURITY_GROUPS = ['default']
@valyagolev
valyagolev / gist:1643096
Created January 19, 2012 21:54
a view which dispatches requests to it to different views
from django.views.generic.base import View
class HttpMethodDependedView(View):
routes = {
}
def dispatch(self, request, *args, **kwargs):
method = request.method.lower()
if method in self.routes:
class EntityItself(models.Model):
"""Все что мы хотим от нее - уникальный PrimaryKey"""
def current_state(self):
return self.entitystate_set.latest()
def __getattr__(self, attr):
return getattr(self.current_state(), attr)
class EntityState(models.Model):