Skip to content

Instantly share code, notes, and snippets.

View faberyx's full-sized avatar

Fabrizio Catitti faberyx

View GitHub Profile
@faberyx
faberyx / init.d
Last active December 21, 2021 20:00
#!/bin/bash
# myapp daemon
# chkconfig: 345 20 80
# description: myapp daemon
# processname: myapp
. /etc/init.d/functions
D_PATH="/home/fabry/Documents/service_test/"
D_NAME=srv_test
@faberyx
faberyx / c++ daemon
Last active December 21, 2021 19:59
#include <stdio.h>
#include <signal.h>
#include <syslog.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@faberyx
faberyx / nginxproxy
Last active April 11, 2017 09:53
nginx proxy
# loca
upstream app_indico {
server 127.0.0.1:3001;
}
upstream app_thezoo{
server 127.0.0.1:3002;
}
@faberyx
faberyx / machine.js
Last active September 29, 2019 22:03
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@faberyx
faberyx / machine.js
Last active September 30, 2019 13:24
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@faberyx
faberyx / gist:30bed36ed1806f252396908a9ad3c932
Last active March 6, 2023 14:48
react-native save image
import React from 'react';
import { StyleSheet, Button, View, SafeAreaView, Text, Alert } from 'react-native';
import { WebView } from 'react-native-webview';
import * as MediaLibrary from 'expo-media-library';
import * as FileSystem from 'expo-file-system';
const App = () => {
// save image
const SaveToPhone = async (imagedata: string) => {
// get the base64 image string
@faberyx
faberyx / gist:0d7550c9212ab03626880892f3fa43d3
Last active March 8, 2023 15:47
react native download
import React from 'react';
import { StyleSheet, Button, View, SafeAreaView, Text, Alert } from 'react-native';
import { WebView } from 'react-native-webview';
import RNFS from 'react-native-fs';
const App = () => {
// save image
const SaveToPhone = async (data: string) => {
// get the base64 image string
const imageData = data.split('data:image/png;base64,')[1];