Skip to content

Instantly share code, notes, and snippets.

Avatar
🎲
Gambling with life.

Petrică Martinescu petrica

🎲
Gambling with life.
View GitHub Profile
@simme
simme / Base64Image.php
Created December 30, 2010 09:57
Returns the Base64 encoded version of an image. Has basic support for Drupal module ImageCache. Does not depend on Drupal.
View Base64Image.php
<?php
/**
* @file
* Helper class for encoding images as Base64.
* Has support for the Drupal module ImageCache, just provide it with your
* preset name if you'd like the class to use that version of an image instead.
* Is by no means dependent on Drupal though. Just a nice feature.
* Feel free to use it as you like.
*
* @author Simon Ljungberg <simon@nimnim.se>
@mrchief
mrchief / LICENSE.md
Last active January 3, 2023 20:44
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)
View LICENSE.md

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@StudioEtrange
StudioEtrange / MacOS X El Capitan with Vagrant - MacOS X VM on Windows or Linux.md
Last active January 5, 2023 17:22
MacOS X El Capitan with Vagrant - MacOS X VM on Windows/Linux
View MacOS X El Capitan with Vagrant - MacOS X VM on Windows or Linux.md
@ErikFontanel
ErikFontanel / filter-youtube-domains.sh
Last active January 18, 2023 23:50
Pi-hole Youtube ad blocking
View filter-youtube-domains.sh
#!/bin/sh
# This script will fetch the Googlevideo ad domains and append them to the Pi-hole block list.
# Run this script daily with a cron job (don't forget to chmod +x)
# More info here: https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253/136
# File to store the YT ad domains
FILE=/etc/pihole/youtube.hosts
# Fetch the list of domains, remove the ip's and save them
curl 'https://api.hackertarget.com/hostsearch/?q=googlevideo.com' \
@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active February 1, 2023 08:57
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
View bash-cheatsheet.sh
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active February 6, 2023 12:50
Opening and closing an SSH tunnel in a shell script the smart way
View opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@staltz
staltz / introrx.md
Last active February 8, 2023 08:25
The introduction to Reactive Programming you've been missing
View introrx.md