Skip to content

Instantly share code, notes, and snippets.

View dejanstojanovic's full-sized avatar
🎧
Focusing

Dejan Stojanovic dejanstojanovic

🎧
Focusing
View GitHub Profile
@BeerOnBeard
BeerOnBeard / install-kubernetes-on-buster.sh
Created January 24, 2020 15:51
Set up a single-node Kubernetes system on Debian 10 (Bustomer). Use Flannel as the network fabric. Install the Kubernetes dashboard.
#!/bin/bash
set -e;
# Set up a single-node Kubernetes system on Debian 10 (Buster).
# Use Flannel as the network fabric. Install the Kubernetes
# dashboard.
# disable swap
swapoff -a;
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active May 6, 2024 08:45
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@dejanstojanovic
dejanstojanovic / Gzip.java
Created September 1, 2016 13:20
Java gzip compress/decompress string
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
public class Gzip {
@sourceperl
sourceperl / say_cpu_temp.py
Last active February 18, 2021 14:45
Text to speak software with espeak and mbrola. Test on Raspberry Pi2 (Raspbian/jessie) and Pi4 (Raspbian/buster).
#!/usr/bin/env python3
import os, time
while True:
with open('/sys/class/thermal/thermal_zone0/temp', 'r') as f:
cpu_temp = round(float(f.read()) / 1000)
os.system('espeak -v mb-fr1 -s 95 \'La température de la CPU est de %s degrés.\'' % cpu_temp)
time.sleep(2.0)
package org.mvryan.http;
import static io.netty.buffer.Unpooled.copiedBuffer;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
/*
Do not modify this version of the file. It will be copied over when any of the project's targets are built.
If you wish to modify mraid.js, modify the version located at mopub-sdk-common/mraid/mraid.js.
*/
(function() {
var isIOS = (/iphone|ipad|ipod/i).test(window.navigator.userAgent.toLowerCase());
if (isIOS) {
console = {};
console.log = function(log) {
var iframe = document.createElement('iframe');
@ifrahim
ifrahim / CreateIISSite
Created February 26, 2014 15:31
Create IIS Site using Powershell
# The following code will create an IIS site and it associated Application Pool.
# Please note that you will be required to run PS with elevated permissions.
# Visit http://ifrahimblog.wordpress.com/2014/02/26/run-powershell-elevated-permissions-import-iis-module/
# set-executionpolicy unrestricted
$SiteFolderPath = "C:\WebSite" # Website Folder
$SiteAppPool = "MyAppPool" # Application Pool Name
$SiteName = "MySite" # IIS Site Name
$SiteHostName = "www.MySite.com" # Host Header
@yemrekeskin
yemrekeskin / ObjectMapper.cs
Last active September 11, 2022 12:36
using Automapper vs Custom Object Mapper(with reflection) for data transformation of objects
public class BaseModel
{
public Guid Id { get; set; }
public DateTime CreateDate { get; set; }
public bool IsActive { get; set; }
public string LastUpdatingUserName { get; set; }
public DateTime LastUpdatingDate { get; set; }
}
@IngmarBoddington
IngmarBoddington / statusCodes
Last active March 22, 2024 21:35
HTTP Status Codes / Verbs List
CONNECT
DELETE
GET
HEAD
OPTIONS
PATCH
POST
PUT
TRACE
@HenrikFrystykNielsen
HenrikFrystykNielsen / SelfHostWithAssembliesResolver.cs
Created June 10, 2012 23:56
ASP.NET Web API: Controlling assemblies loaded by providing own AssembliesResolver
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Dispatcher;
using System.Web.Http.SelfHost;
namespace SelfHost
{