Skip to content

Instantly share code, notes, and snippets.

View JBlond's full-sized avatar

Mario JBlond

  • Germany
  • 01:38 (UTC +02:00)
View GitHub Profile
@JBlond
JBlond / number-game.c
Last active January 7, 2025 12:49
number-game
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int myNumber = 0;
int tries = 0;
int zahl = 0;
int main() {
srand((unsigned int) time(0));
@JBlond
JBlond / update-portainer.sh
Last active April 10, 2023 12:31
update portainer
#!/bin/bash
docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce:2.14.0
docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=portainer --restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:2.14.0
@JBlond
JBlond / cloudflare.php
Created July 5, 2022 08:02
change IP if it is coming from cloudflare
<?php
//Cloudflare IP Reset
//See if ip fits in IP range
function ip_in_network($ip, $net_addr, $net_mask){
if($net_mask <= 0){ return false; }
$ip_binary_string = sprintf("%032b",ip2long($ip));
$net_binary_string = sprintf("%032b",ip2long($net_addr));
return (substr_compare($ip_binary_string,$net_binary_string,0,$net_mask) === 0);
}
//See if the "Cloudflare IP" is really a cloudflare IP
@JBlond
JBlond / smc_read smc_read.c
Created May 17, 2022 08:42
Mac OS X 10.5 smc_read smc_read
/*
* smc_read.c: Written for Mac OS X 10.5. Compile as follows:
*
* gcc -Wall -o smc_read smc_read.c -framework IOKit
*/
#include <stdio.h>
#include <IOKit/IOKitLib.h>
@JBlond
JBlond / tupleSort.php
Created November 18, 2021 10:47
tupleSort
<?php
/**
* Sort an array by the nested arrays it contains. Helper function for getMatchingBlocks
*
* @param array $aArray First array to compare.
* @param array $bArray Second array to compare.
*
* @return int -1, 0 or 1, as expected by the usort function.
*/
public static function tupleSort(array $aArray, array $bArray): int
@JBlond
JBlond / LdapAuth.php
Last active April 10, 2023 12:32
LdapAuth php
<?php
/**
* LDAP Auth Handler
*/
class LdapAuth
{
/**
* @var false|resource
*/
private $handle;
@JBlond
JBlond / 99fixbadproxy
Created October 11, 2021 08:01 — forked from trastle/99fixbadproxy
Fixing the issue with apt caused by a bad local proxy: -1- Create 99fixbadproxy at: /etc/apt/apt.conf.d/99fixbadproxy -2- Run clear.sh
Acquire::http::Pipeline-Depth "0";
Acquire::http::No-Cache=True;
Acquire::BrokenProxy=true;
@JBlond
JBlond / change-wallpaper.bat
Created September 1, 2021 06:43 — forked from eliashussary/change-wallpaper.bat
A simple batch script to change your windows wallpaper. It takes a single argument, the path of your desired wallpaper.
echo off
:: Handle CLI Args
IF [%1]==[] (
echo No wallpaper path provided, please provide a full qualified path. Ex: C:\dir1\dir2\wallpaper.jpg
exit /b 1
)
:: Commands
echo Changing wallpaper to: %1
@JBlond
JBlond / generateChangelog.php
Created January 26, 2021 10:47
generate Changelog
<?php
$output = "# changelog\n\n";
$previousTag = 0;
$gitTags = shell_exec("git tag --sort=-creatordate");
$gitTagsArray = explode("\n", $gitTags);
foreach ($gitTagsArray as $gitTag) {
@JBlond
JBlond / smb.conf
Created December 27, 2020 09:48
smb tuning Windows 10
[global]
read raw = Yes
write raw = Yes
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072
min receivefile size = 16384
use sendfile = true
aio read size = 16384
aio write size = 16384
protocol = SMB3