Skip to content

Instantly share code, notes, and snippets.

View gregyjames's full-sized avatar
🔺
Avoiding Frontend

Greg gregyjames

🔺
Avoiding Frontend
View GitHub Profile
@gregyjames
gregyjames / tiny.dockerfile
Created December 24, 2023 11:24
Tiniest possible GO Docker image
FROM golang:alpine as golang
# Create appuser (only for scratch)
ENV USER=appuser
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
@sven-bock
sven-bock / threadpool.cpp
Last active December 18, 2023 14:02
Sample how to create a boost threadpool in a class
#include <boost/asio/io_service.hpp>
#include <boost/bind.hpp>
#include <boost/thread/thread.hpp>
#include <boost/make_shared.hpp>
#include <iostream>
class Bla{
public:
void callback(std::string msg){
@rwev
rwev / BAW.py
Last active December 29, 2024 22:29
Python implementation of the Barone-Adesi And Whaley model for the valuation of American options and their greeks.
"""
BAW.PY
Implements the Barone-Adesi And Whaley model for the valuation of American options and their greeks.
"""
import numpy as _np
import cmath as _cm
# Option Styles
@carry0987
carry0987 / RPi3-Auto-WiFi.md
Last active July 6, 2025 09:12
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect

Auto reconnect to wifi when lost connection

Before you start, make sure ip command is available on your system. In modern Linux distributions, ip replaces older ifconfig command. If net-tools package (that includes ifconfig) is not installed and you prefer using it, you can install it via sudo apt-get install net-tools.

Create script file

Use touch /home/pi/wifi-reconnect.sh to create a shell script file, with the following content:

#!/bin/bash
@dimitrispaxinos
dimitrispaxinos / SerilogHttpClientWrapper.cs
Last active October 31, 2024 18:43
HttpClient Wrapper with logging functionality using Serilog
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Serilog.Context;
namespace Serilog.RestCallMonitoring
{
public class SerilogHttpClientWrapper : HttpClient
{
private static string _templateString =
@santanuchakrabarti
santanuchakrabarti / RE_to_Grammar_Algorithm.md
Last active December 5, 2021 21:12
An algorithm to generate a Regular Grammar from a Regular Expression
@takekazuomi
takekazuomi / csharp.gitignore
Created April 17, 2014 05:47
.gitignore for C#
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
@peterk87
peterk87 / Parse Genbank file using BioPython.py
Last active September 16, 2024 12:25
Python: Parse Genbank file using BioPython
import os
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.SeqFeature import SeqFeature, FeatureLocation
from Bio import SeqIO
# get all sequence records for the specified genbank file
recs = [rec for rec in SeqIO.parse("genbank_file.gbk", "genbank")]
# print the number of sequence records that were extracted