Skip to content

Instantly share code, notes, and snippets.

View agrippa1994's full-sized avatar

Manuel Leitold agrippa1994

  • DCCS GmbH
  • Styria, Austria
View GitHub Profile
#include <unistd.h>
#include <node.h>
#include <string.h>
#include <v8.h>
using namespace v8;
unsigned long long count = 0;
// native blocking/compute intensive function
@jedthehumanoid
jedthehumanoid / serialport-electron.md
Last active June 11, 2018 19:47
Build node serialport for electron

Building node-serialport for Electron on Windows

These instruction are for Windows, on my Linux installation(Fedora 21) everything works by just installing serialport with npm (I don't know why!).

These are the steps I did to build node serialport for electron (formerly atom-shell) for Windows. I am completely certain there is a better way to do it, but since I struggled with it for quite a while, here is a solution anyway.

You need some version of Visual studio installed, I have VS 2012 Express for Desktop.

@david7482
david7482 / C++11_string_swtich.cpp
Last active December 14, 2023 21:09
Use C++11's constexpr to achieve string switch
// http://stackoverflow.com/a/107657
constexpr unsigned long long int HashStringToInt(const char *str, unsigned long long int hash = 0)
{
return (*str == 0) ? hash : 101 * HashStringToInt(str + 1) + *str;
}
void simple_switch(const std::string &str)
{
switch (HashStringToInt(str.c_str()))
{
@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@cschiewek
cschiewek / x11_docker_mac.md
Last active July 18, 2025 00:09
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active August 25, 2025 04:45
Building a react native app in WSL2

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

@tumainimosha
tumainimosha / page-info.ts
Last active November 22, 2024 12:37
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@knolleary
knolleary / README.md
Last active February 15, 2023 18:46
Example Node-RED that adds a sidebar panel in the editor

Example Node-RED that adds a sidebar panel in the editor

  1. git clone this gist somewhere

  2. In ~/.node-red run: npm install <path to where the gist is>

  3. Restart Node-RED

  4. Reload the editor and marvel at the new sidebar tab

@mcarlton00
mcarlton00 / Jellyfin-api-auth-example.py
Last active August 6, 2025 21:11
Example for authenticating to Jellyfin API from Python
import requests
# Define connection details
server_url = 'http://192.168.0.200:8096'
username = 'User'
password = 'Password'
# Build json payload with auth data
auth_data = {
'username': username,