Skip to content

Instantly share code, notes, and snippets.

View UlasSAYGINIM's full-sized avatar

Ulaş SAYGIN UlasSAYGINIM

View GitHub Profile
@corburn
corburn / CSP.md
Last active September 20, 2023 12:55 — forked from xrstf/letsencrypt.md
Nginx server notes

The following is from scotthelme.co.uk

Content Security Policy

with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), you can tell the browser that it can only download content from the domains you explicitly allow http://www.html5rocks.com/en/tutorials/security/content-security-policy/ https://www.owasp.org/index.php/Content_Security_Policy I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval'

Networking

Routing | Additional IP | Change MAC | Ports | Firewall | IP Forward | NAT | DNS | DHCP | Traffic | QoS | NIS | Netcat

#Debugging (See also Traffic analysis) ##Linux

# ethtool eth0              # Show the ethernet status (replaces mii-diag)
# ethtool -s eth0 speed 100 duplex full # Force 100Mbit Full duplex

ethtool -s eth0 autoneg off # Disable auto negotiation

@vivianspencer
vivianspencer / server_hardening.md
Last active January 28, 2025 09:00
Debian 8 Hardening

Debian 8 Hardening

  1. Update root's mail recipient. Open /etc/aliases replacing [email protected] with an administrator's email address. This is where logs will be emailed.

    root:     [email protected]
    
  2. Update the the default umask to 027. Edit the file /etc/init.d/rc and change the following setting:

umask 027

@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@tokhi
tokhi / unixToolbox.md
Last active October 10, 2024 16:30
Collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users.

#Unix Toolbox

This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing.

##Unix Toolbox revision 14.4

The latest version of this document can be found at http://cb.vu/unixtoolbox.xhtml. Replace .xhtml on the link with .pdf for the PDF version and with .book.pdf for the booklet version. On a duplex printer the booklet will create a small book ready to bind. This XHTML page can be converted into a nice PDF document with a CSS3 compliant application (see the script example). See also the about page.
Error reports and comments are m
@mattsve
mattsve / setup.sh
Last active March 19, 2018 20:14
Freebsd
#!/bin/sh
# sysctls for jail needs to be
# allow.raw_sockets=true,allow.sysvipc=1
# Enable sshd
sed -i .bak 's/sshd_enable="NO"/sshd_enable="YES"/' /etc/rc.conf
rm /etc/rc.conf.bak
# Add sudo
pkg install sudo
@HappyCerberus
HappyCerberus / FastLineReader.cpp
Created March 31, 2015 11:53
Fast line-by-line file parser
#include "FastLineReader.h"
// POSIX
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
# uname -a
FreeBSD blynk.waitman.net 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r275492: Fri Dec 5 06:52:11 PST 2014 [email protected]:/usr/obj/usr/src/sys/BLYNK amd64
# usbconfig -d 0.5 dump_device_desc
ugen0.5: <CSR8510 A10 vendor 0x0a12> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
bLength = 0x0012
bDescriptorType = 0x0001
@cypres
cypres / UIImageExt.swift
Created March 16, 2015 14:06
UIImage from UIImagePickerController resize + fix orientation
import UIKit
extension UIImage {
// Based on http://stackoverflow.com/a/1262395/449607
// Optimized for JPEG output
func imageResized(longEdge : CGFloat) -> UIImage {
func radians (degrees : Double) -> CGFloat {
return CGFloat(degrees * M_PI/180)
}
@cfstras
cfstras / -Build static versions of binutils, for example ld, gprof, nm, strip, objdump, ar, strings; with mingw or on *nix
Last active March 19, 2025 18:42
Build static versions of binutils, for example ld, gprof, nm, strip, objdump, ar, strings; with mingw or on *nix
See the bash script below. :)
Tested on debian bookworm-slim (`docker pull debian:bookworm-slim`).
### Prerequisites
```bash
apt update
apt install -y build-essential wget bison
```