Skip to content

Instantly share code, notes, and snippets.

@jmangelo
jmangelo / AppConfig.Transformation.targets
Created June 21, 2010 21:37
VS 2010 RTM - MSBuild Project file for App.config XML transformations.
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- 20110224 : Ryan Milligan : Created OverrideAppConfigWithTargetPath target to fix ClickOnce deploy bug -->
<!-- 20100827 : João Angelo : Fixed bug when using Publish command within Visual Studio -->
<PropertyGroup>
<!-- Prevent circular dependency on Build target -->
<PipelineDependsOnBuild>false</PipelineDependsOnBuild>
<!-- Override project config file name (By default is set to Web.config) -->
<ProjectConfigFileName>App.Config</ProjectConfigFileName>
</PropertyGroup>
@soarez
soarez / ca.md
Last active July 19, 2024 04:05
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@gnilchee
gnilchee / https_server_multithread.py
Last active March 11, 2022 19:51
Multi-threaded Python 3 HTTPS Server
#!/usr/bin/env python3
import sys, os, socket, ssl
from socketserver import ThreadingMixIn
from http.server import SimpleHTTPRequestHandler, HTTPServer
HOST = socket.gethostname()
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
pass
@Manouchehri
Manouchehri / cloudflare.sh
Last active July 15, 2024 09:25
Allow CloudFlare only
# Source:
# https://www.cloudflare.com/ips
# https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables-
for i in `curl https://www.cloudflare.com/ips-v4`; do iptables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
for i in `curl https://www.cloudflare.com/ips-v6`; do ip6tables -I INPUT -p tcp -m multiport --dports http,https -s $i -j ACCEPT; done
# Avoid racking up billing/attacks
# WARNING: If you get attacked and CloudFlare drops you, your site(s) will be unreachable.
iptables -A INPUT -p tcp -m multiport --dports http,https -j DROP
@pwlin
pwlin / gist:8a0d01e6428b7a96e2eb
Last active July 20, 2024 17:34
Android : add cert to system store
https://code.google.com/p/android/issues/detail?id=32696#c5
If you have a certificate that is not
trusted by Android, when you add it, it goes in the personal cert store.
When you add a cert in this personal cert store, the system requires a
higher security level to unlock the device. But if you manage to add your
cert to the system store then you don't have this requirement. Obviously,
root is required to add a certificate to the system store, but it is quiet
easy.
@tiramiseb
tiramiseb / extract_wp_comments_for_pelican.py
Created May 30, 2016 08:15
Import WordPress comments to Pelican Comment System
#!/usr/bin/env python3
"""
This script :
* extracts comments from a WordPress eXtended RSS export file
* creates comment files for the Pelican comment system, in a "content/comments"
directory in the current path
The script takes the XML file name as its only argument.
@miteshsureja
miteshsureja / FileDetails.cs
Created March 8, 2017 14:06
How to find and delete duplicate files from directory using C# code?
using System;
namespace DuplicateFileFinder
{
public class FileDetails
{
public string FileName { get; set; }
public string FileHash { get; set; }
}
}
@therightstuff
therightstuff / RSAKeys.cs
Last active May 24, 2024 14:20
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@shtrom
shtrom / fritz_cert_upload.py
Last active March 12, 2023 17:01
Upload a TLS key and cert to a FRITZ!Box, in pretty Python
#!/usr/bin/env python3
# vim: fileencoding=utf-8
"""
Upload a TLS key and cert to a FRITZ!Box, in pretty Python
Copyright (C) 2018--2021 Olivier Mehani <shtrom@ssji.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@peteristhegreat
peteristhegreat / Readme.md
Last active July 23, 2024 00:09
Realtek bluetooth usb adapter RTL8671b