Skip to content

Instantly share code, notes, and snippets.

View JoeUX's full-sized avatar

Joe Duarte JoeUX

View GitHub Profile
void printInts(List<int> a) => print(a);
void main() {
var list = <int>[];
list.add(1);
list.add(2);
printInts(list);
}
void printInts(List<int> a) => print(a);
void main() {
var list = [];
list.add(1);
list.add("2");
printInts(list);
}
@JoeUX
JoeUX / BasicDart.dart
Last active October 1, 2018 04:54
A basic Dart program, taken from the Dart website
// Define a function.
printInteger(int aNumber) {
print('The number is $aNumber.'); // Print to console.
}
// This is where the app starts executing.
main() {
var number = 42; // Declare and initialize a variable.
printInteger(number); // Call a function.
}
@JoeUX
JoeUX / Horrible Rust Example.rs
Last active October 5, 2018 06:07
Rust example
fn process(from: &Path, to: &Path) -> IoResult<()> {
// creates a new tempdir with the specified suffix
let tempdir = try!(TempDir::new("skylight"));
// open the input file
let mut from_file = try!(File::open(from));
// create a temporary file inside the tempdir
let mut tempfile =
try!(File::create(&tempdir.path().join("tmp1")));
@JoeUX
JoeUX / JavaEx1.java
Created September 20, 2018 01:26
Java example
package com.java2novice.files;
import java.io.File;
public class FilesListFromFolder {
public static void main(String a[]){
File file = new File("C:/MyFolder/");
File[] files = file.listFiles();
for(File f: files){
System.out.println(f.getName());
}
}
@JoeUX
JoeUX / compile-nginx.sh
Last active March 5, 2022 18:36 — forked from tollmanz/compile-nginx.sh
Optimized nginx compilation flags for modern CPUs, faster math, and LTO. This should be much faster than vanilla nginx builds. Still testing.
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN. I updated this block to get the latest 1.0.2h release. It's critical that OpenSSL be up to date.
@JoeUX
JoeUX / Hardened EMET config.xml
Created July 6, 2016 00:00
Hardened Microsoft Windows EMET config file
<!-- Microsoft EMET is a free tool can dramatically improve the security of the OS and applications. It can force Data Execution Protection (DEP), ASLR, Heap Spray Protection, Export Address Table Access Filtering (EAF), ROP Caller Check, and a few other runtime protections on most applications.
By default, EMET only governs Microsoft Office applications, the Java VM, and major browsers. I've configured EMET to govern many more applications, and this file is my exported config. EMET allows for the export and import of these XML configs. This config covers Python, Ruby, Go, Opera, Pushbullet, UltraEdit, Sublime Text, Vivaldi browser, Wireshark, Fiddler, SpiderOak, WinSCP, MuPDF, ConEmu, LibreOffice, Amazon Music, lots of compression utilities, and much more. The install paths are defaults except for dev tools, which are usually C:\(tool)...
Some apps break when you enfold them in EMET's mitigations, and you have to isolate which of the many mitigations is breaking the app. For example, Amazon Music won