Skip to content

Instantly share code, notes, and snippets.

@G33kDude
G33kDude / mjpeg.py
Last active January 5, 2023 11:19
Stream a webcam over HTTP using the MJPEG protocol
#!/usr/bin/env python2
import time
# HTTP
import BaseHTTPServer
import SimpleHTTPServer
import SocketServer
import threading
@mrenvoize
mrenvoize / Controller-Priority.pm
Created January 5, 2018 08:57
Multi-create Fun
my $list_changeResult = $c->db->resultset('ListChange')->create(
{
list_id => $list_id,
request => [{requester_id => $requester_id, assignee_id => $assignee_id, status => 'new'}],
message => {
buffer_id => $list_id,
user_id => $requester_id,
text => "Priority tag '$tag' was removed from the system.",
important => 1
}
@fulezi
fulezi / ImGuiHandler.cpp
Last active March 25, 2024 02:47 — forked from hb3p8/ImGuiHandler.cpp
ImGui OpenSceneGraph wrapper
#include "ImGuiHandler.hpp"
#include "imgui/imgui.h"
#include <iostream>
#include <osgUtil/GLObjectsVisitor>
#include <osgUtil/SceneView>
#include <osgUtil/UpdateVisitor>
@aras-p
aras-p / sysinfo.pl
Created October 27, 2017 08:43
Perl get hardware/OS data without non-standard modules
#!/usr/bin/perl
BEGIN {
if ($^O eq "MSWin32")
{
require Win32; Win32::->import();
require Win32::API; Win32::API::->import();
require Win32::TieRegistry; Win32::TieRegistry::->import();
}
}
use List::Util 'first';
@jsbueno
jsbueno / colors.py
Created October 22, 2017 14:27
Terminal colors and gradients in Python
import io
import sys
ANSI_SEQ = "\x1b[{}m"
FG_RGB = "38;2;{};{};{}"
BG_RGB = "48;2;{};{};{}"
RESET="0"
FRAMED="51"
ATTRS = {key:code for key, code in [line.strip().split() for line in """\
@kosmolot
kosmolot / serialization.vala
Last active March 14, 2021 11:29
Vala partial serialization (using json-glib)
/*
* An example of serialization.
* This example serializes and deserializes only 'x' property.
*
* vala: 0.36.3
* json-glib: 1.3.2
*/
public class Point : GLib.Object, Json.Serializable {
public int x { get; set; }
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 16:19
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@manasthakur
manasthakur / plugins.md
Last active May 2, 2024 05:48
Managing plugins in Vim

Managing plugins in Vim: The basics

Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo. First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git) or simply downloading it as a zip (from its GitHub page).

Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim directory by default). For example, if the layout of a plugin foo is as follows:

foo/autoload/foo.vim
foo/plugin/foo.vim
@irondoge
irondoge / macro.cpp
Created December 1, 2016 17:39
Recursive variadic C/C++ macro. [compilation: gcc -std=c++11 macro.cpp]
#include <stdio.h>
#define PRINT(...) CAT(CT(__VA_ARGS__))(__VA_ARGS__)
#define CAT(N) DOG(N)
#define DOG(N) PRINT ## N
/* max supported args is 5 for now */
#define CT(...) VALS(__VA_ARGS__, 5, 4, 3, 2, 1)
#define VALS(N1, N2, N3, N4, N5, N, ...) N
@CMCDragonkai
CMCDragonkai / tz-windows-to-iana.sh
Last active February 27, 2022 15:15
CLI: Convert Windows CLDR Timezone to IANA Timezone Identifiers
#!/usr/bin/env bash
if [[ "$@" == "" || "$@" == *-h* || "$@" == *--help* ]]; then
cat<<EOF
tz-windows-to-iana - Convert Windows timezone CLDR to IANA Identifiers.
You can acquire Windows timezone CLDR by using the CMD tool \`tzutil\`.
There are 2 protocols for identifying timezones.
There is the IANA timezone database: https://en.wikipedia.org/wiki/Tz_database
There is the Unicode Common Locale Data Repository: http://cldr.unicode.org/