Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@siamware
siamware / Office_kms
Created July 13, 2019 07:07 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
cd\Program Files\Microsoft Office\Office16
cd\Program Files (x86)\Microsoft Office\Office16
cscript OSPP.VBS /sethst:kms.digiboy.ir
cscript OSPP.VBS /actcscript OSPP.VBS /dstatus
slmgr.vbs /ckms
@siamware
siamware / cache.phpi
Created February 24, 2019 12:52 — forked from CAFxX/cache.phpi
PHP remote file/URL cache
<?php
/*
A simple cache for remote files/URLs
2011 Carlo Alberto Ferraris <cafxx@strayorange.com>
===================================================
The cache function allows you to get the contents of a remote URL at
most once every N seconds. It also supports the If-Modified-Since HTTP
header to avoid fetching the resource again if it hasn't changed.
@siamware
siamware / watermark.html
Created August 21, 2018 15:57 — forked from mloberg/watermark.html
Watermark PHP
<img src="watermark.php?watermark=watermark.png&src=test.jpg" />
@siamware
siamware / block-tor.sh
Created May 31, 2018 00:54 — forked from tiagoad/block-tor.sh
Cronjob to block tor exit nodes with nginx on debian 8 jessie
wget -qO- https://check.torproject.org/exit-addresses | grep ExitAddress | cut -d ' ' -f 2 | sed "s/^/deny /g; s/$/;/g" > /etc/nginx/conf.d/tor-block.conf; systemctl reload nginx
@siamware
siamware / cache.php
Created April 9, 2018 07:18 — forked from mibrahim/cache.php
php caching
https://davidwalsh.name/php-cache-function
/* gets the contents of a file if it exists, otherwise grabs and caches */
function get_content($file,$url,$hours = 24,$fn = '',$fn_args = '') {
//vars
$current_time = time(); $expire_time = $hours * 60 * 60; $file_time = filemtime($file);
//decisions, decisions
if(file_exists($file) && ($current_time - $expire_time < $file_time)) {
//echo 'returning from cached file';
return file_get_contents($file);
@siamware
siamware / cache-json.php
Created April 9, 2018 04:35 — forked from erwstout/cache-json.php
Write JSON file and cache it.
<?php
/**
* Write an array to a JSON file. Replace $data with your array,
* and skip JSON encoding if you already have JSON
*/
function write_data_to_file( $filename ) {
$json = file_get_contents( 'http://path.to/external-site/file.json');
$time = time();
file_put_contents( $filename, $json );
}
@siamware
siamware / reverse.cs
Created January 5, 2018 02:23
C# Reverse Shell
using System;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Sockets;
namespace ConnectBack
@siamware
siamware / http-benchmark.md
Created May 3, 2017 13:25 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@siamware
siamware / index.html
Created March 24, 2017 20:19
Working Facebook Reactions count and webpage show
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Facebook Reactions</title>
<style>
html {
box-sizing: border-box;
width: 100%;
height: 100%;
#!/bin/sh -x
# ==================================
# iptables default configuration script
#
# - this locks down our servers port access
# ==================================
# install fail2ban
sudo apt-get update