Skip to content

Instantly share code, notes, and snippets.

View amka's full-sized avatar
🚏
Working from …

Andrey M amka

🚏
Working from …
View GitHub Profile
@cwensley
cwensley / RunEtoWithBackgroundTasks.cs
Last active July 24, 2023 11:40
Shows how to use Eto.Forms with async/await and background tasks to perform long running work while keeping the UI responsive.
using System;
using Eto.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Eto.Drawing;
namespace RunEtoWithBackgroundTasks
{
#!/usr/bin/env python
"""
Upload image to http://drp.io in terminal.
"""
from __future__ import print_function
import sys
@fish2000
fish2000 / embedded-internal.py
Created July 15, 2014 14:50
Embedded PyObjC app bundle internal sys.path leapfrog
# rather than hijacking PYTHONPATH in the .m loader, add the module directory now
sys.path.insert(0,
'%s/Contents/Resources/python' % abspath(
Foundation.NSBundle.mainBundle().bundlePath()))
@Cilyan
Cilyan / soundtrack.py
Last active December 19, 2021 11:39
Draws the envelop (waveform) of a track on a Gtk.DrawingArea (vertically), uses PyGI and GStreamer
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Sources:
#
# https://stackoverflow.com/questions/9344888/getting-max-amplitude-for-an-audio-file-per-second
# https://git.gnome.org/browse/pitivi/tree/pitivi/timeline/previewers.py
# http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-audioconvert.html
# http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-level.html
# https://git.gnome.org/browse/pitivi/tree/pitivi/coptimizations/renderer.c
@mariocesar
mariocesar / app_granite.py
Last active June 29, 2021 08:35
Python GTK3 desktop app and Granite App (Elementary OS Desktop)
import sys
from gi.repository import Granite
from gi.repository import Gtk
from gi.repository import Gio
class LightWindow(Gtk.Dialog):
def __init__(self):
super(LightWindow, self).__init__()
@kethinov
kethinov / walksync.js
Created September 22, 2013 09:04
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@ftvs
ftvs / CameraShake.cs
Last active April 17, 2024 23:08
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
@sahib
sahib / clutter.py
Created May 4, 2013 19:56
Playing around with Python/Clutter/Gtk. Simple Swipe Effect.
from gi.repository import GLib, Gtk, GtkClutter, Clutter, Gdk, GdkPixbuf
import sys
from random import random
BROWSERS = 42
class ClutterBrowser(Gtk.ApplicationWindow):
@antdimot
antdimot / Repository.cs
Last active July 7, 2022 23:59
Example of mongodb repository in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
anonymous
anonymous / NSDictionary URL encoding extension
Created January 8, 2013 09:17
Extends NSdictionary with urlEncodedString
#import <Foundation/Foundation.h>
@interface NSDictionary (URLEncoding)
-(NSString*) urlEncodedString;
@end
// helper function: get the string form of any object