This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Host file to block Samsung tv adverts. List from: https://www.helpmegeek.com/block-ads-on-smart-tv-samsung-sony-lg/ | |
# =================================================================== | |
0.0.0.0 config.samsungads.com | |
0.0.0.0 gpm.samsungqbe.com | |
0.0.0.0 log-config.samsungacr.com | |
0.0.0.0 samsung.com | |
0.0.0.0 samsungacr.com | |
0.0.0.0 samsungads.com | |
0.0.0.0 samsungads.com | |
0.0.0.0 samsungotn.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import sys | |
def md5Experiment(domain_name, total_shards): | |
hash_obj = hashlib.md5(domain_name) | |
digest = hash_obj.hexdigest() | |
shard_id = int(digest, 16) % total_shards | |
return shard_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.charset.StandardCharsets; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.MessageDigest; | |
import java.math.BigInteger; | |
class md5Experiment { | |
public static int getDatabaseID(String domainName, int totalShards) { | |
byte[] bytesOfDomainName = domainName.getBytes(StandardCharsets.UTF_8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Takes the total bill and percentage to generate the results | |
* @param {[type]} pay_bill [description] | |
* @param {[type]} percentage_in_england [description] | |
* @constructor | |
*/ | |
function ApprenticeshipLevyCalculator(pay_bill, percentage_in_england) { | |
var results = { | |
totalLevy : (pay_bill*0.005).toFixed(0), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filename = 'master_no_duplicates.csv'; | |
$contents = file($filename); | |
function get_domain($url) | |
{ | |
$pieces = parse_url($url); | |
$domain = isset($pieces['host']) ? $pieces['host'] : ''; | |
if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) { | |
return $regs['domain']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Resource proxy with search and replace functionality on resources (e.g. css, js) in order to get around CORS restrictions. | |
https://hubbounce.services.example.co.uk/?resource_url=https://example.com/wp-content/themes/example-training/dist/css/main.min.css&search=url(../fonts/&replace=url(https://cdn2.hubspot.net/hubfs/4668366/fonts/ | |
*/ | |
$resource_url = $_GET['resource_url']; | |
$search = $_GET['search']; | |
$replace = $_GET['replace']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Used instead of delay so various things can still be checked (e.g. button presses, saving data). | |
int workingDelay(int interval) { | |
unsigned long previousMillis = millis(); | |
while(true) { | |
unsigned long currentMillis = millis(); | |
Serial.println(currentMillis); | |
// If the current miliseconds run is more than the interval, the delay has been done, so exit. | |
if(currentMillis - previousMillis > interval) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "boost/filesystem.hpp" | |
using namespace std; | |
using namespace boost::filesystem; | |
int main(int argc, char *argv[]) | |
{ | |
// list all files in current directory. | |
//You could put any file path in here, e.g. "/home/me/mwah" to list that directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <magic.h> | |
int main(void) | |
{ | |
char *actual_file = "/file/you/want.yay"; | |
const char *magic_full; | |
magic_t magic_cookie; | |
/* MAGIC_MIME tells magic to return a mime of the file, |