Skip to content

Instantly share code, notes, and snippets.

View CarlosRA97's full-sized avatar

Carlos Rivero Aro CarlosRA97

View GitHub Profile
@CarlosRA97
CarlosRA97 / git.sh
Last active July 7, 2019 18:37
Git client for Docker RPI similar to Alpine Git
#!/bin/bash
docker run -ti --rm -v $1:/git -v $HOME/.ssh:/root/.ssh carlosra97/raspberrypi3-alpine-git ${@:2}
@suru-dissanaike
suru-dissanaike / make-keys.sh
Last active March 28, 2024 11:24
Create self-signed certificates for Eclipse Mosquitto MQTT broker
#!/bin/bash
IP="192.168.1.22"
SUBJECT_CA="/C=SE/ST=Stockholm/L=Stockholm/O=himinds/OU=CA/CN=$IP"
SUBJECT_SERVER="/C=SE/ST=Stockholm/L=Stockholm/O=himinds/OU=Server/CN=$IP"
SUBJECT_CLIENT="/C=SE/ST=Stockholm/L=Stockholm/O=himinds/OU=Client/CN=$IP"
function generate_CA () {
echo "$SUBJECT_CA"
openssl req -x509 -nodes -sha256 -newkey rsa:2048 -subj "$SUBJECT_CA" -days 365 -keyout ca.key -out ca.crt
@kurtsergey
kurtsergey / rn-localization-fetch.js
Last active May 3, 2021 16:12
ReactNative - fetching localization json from Firebase Storage
import _merge from 'lodash/merge';
import i18n from 'react-native-i18n';
import firebase from 'react-native-firebase';
import * as Storage from '../utils/storage'; // just wrapper for AsyncStorage
import { STORAGE_KEY_TRANSLATIONS } from './'; // just key for Storage data, used here to write data, used in main file to read data on app start
@Oranzh
Oranzh / AES-256 encryption and decryption in PHP and C#.md
Created March 24, 2018 04:19
AES-256 encryption and decryption in PHP and C#

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';
@juanfal
juanfal / 04.pattern.cpp
Created February 7, 2018 11:57
words letters coinciding with a pattern
// 04.pattern.cpp
// juanfc 2018-02-06
//
#include <iostream>
#include <array>
using namespace std;
const int PATLENGTH = 5;
const int NNONREPWORDS = 100;
@juanfal
juanfal / buildMagic.cpp
Last active January 18, 2018 00:00
Using Siamese method fill a Magic Square Matrix
// buildMagic.cpp
// juanfc 2018-01-17
// Using Siamese method fill a Magic Square Matrix,
// odd fixed size.
// We have used a big square matrix, but used
// an extra parameter to restrict to that size
//
// Testing it building magic matrices up to a size
// checking they really are magic and printing them
// https://gist.github.com/6db44e77b75d3aacdfa70bdfb7972ef1
1. Install oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
2. Clone necessary plugins.
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3. Add plugins to ~/.zshrc as
plugins = ( [plugins...] zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting)
@troyfontaine
troyfontaine / 1-setup.md
Last active May 3, 2024 10:52
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

The current kernel/drivers of Fedora 24 do not support the Wifi chip used on my Mac Book Pro. Proprietary Broadcom drivers are packaged and available in the rpmfusion repo.

Verify that your card is a Broadcom using: lspci -vnn -d 14e4:

Sample output:

02:00.0 Network controller [0280]: Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter [14e4:43a0] (rev 03)

Install

Install the rpmfusion repo, note only "nonfree" is required, as the Broadcom Driver is proprietry: http://rpmfusion.org/

@CuddleBunny
CuddleBunny / CustomService.cs
Last active December 1, 2019 11:16
DotNetCore Console App with DI and ConfigurationBuilder
using Microsoft.Extensions.Configuration;
using System;
namespace CoreConsole {
public interface ICustomService {
}
public class CustomService : ICustomService {
public CustomService(IConfigurationRoot config) {