Skip to content

Instantly share code, notes, and snippets.

View Sargeanthost's full-sized avatar

Carlos Sargeanthost

  • California
View GitHub Profile
@jewelsea
jewelsea / ListOrganizer.java
Created December 6, 2013 09:47
Use Drag and Drop to reorder items in a JavaFX ListView
import javafx.application.Application;
import javafx.collections.*;
import javafx.geometry.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.input.*;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
@IanHopkinson
IanHopkinson / lxml_examples.py
Created November 24, 2015 19:42
Examples of xpath queries using lxml in python
#!/usr/bin/env python
# encoding: utf-8
import lxml.etree
import lxml.html
import requests
xml_sample = """<?xml version="1.0" encoding="UTF-8"?>
<foo:Results xmlns:foo="http://www.foo.com" xmlns="http://www.bah.com">
<foo:Recordset setCount="2">
@evantoli
evantoli / GitConfigHttpProxy.md
Last active July 20, 2024 03:29
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active July 14, 2024 19:55
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@ishu3101
ishu3101 / loop_string.pl
Created June 7, 2016 00:53
3 ways to loop through each character in a string in Perl
# 3 ways to loop through each character in a string
$text = "hello world";
for $i (0..length($text)-1){
$char = substr($text, $i, 1);
print "Index: $i, Text: $char \n";
}
foreach $char (split //, $text) {
@r0mdau
r0mdau / nginx-ssl-qualys-100%-A+.vhost
Last active February 26, 2021 07:57
Qualys SSL labs How To get A+ and 100% with Nginx
server {
listen 443 ssl deferred;
server_name example.com;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 24h;
ssl_buffer_size 4k;
ssl_session_tickets off;
ssl_protocols TLSv1.2;
@tterb
tterb / README-badges.md
Last active July 3, 2024 13:47
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 26, 2024 01:19
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@asela38
asela38 / java8-one-liners-for-statistical-properties.md
Last active May 11, 2023 23:54
Java 8 One liners for statistical properties : Mean, Mode, Median(Q2), Q1, Q2, Variance, Standard Deviation

While working on a Hacker Rank Problem I wrote few one lines using java stream to find mean, median, mode, Q1, Q3, variance and standard deviation. Thought to share since it's quite interesting.

        // mean
        double mean = list.stream().mapToInt(Integer::intValue).average().getAsDouble();
        System.out.println(mean);
        
        // mode - create count map using group by and sorted with custom comparator to give minimum from competing probable mode values
        Integer mode = list.stream()
                .collect(Collectors.groupingBy(i -> i, () -> new TreeMap<Integer, Long>(), Collectors.counting()))
@williewillus
williewillus / 1132_to_114.xml
Last active July 16, 2022 02:14
1.13.2 -> 1.14 migration mappings
<?xml version="1.0" encoding="UTF-8"?>
<migrationMap>
<name value="1.13.2 to 1.14" />
<description value="1.13.2 to 1.14 MCP changes" />
<entry oldName="net.minecraft.GameVersion" newName="net.minecraft.util.MinecraftVersion" type="class" />
<entry oldName="net.minecraft.advancements.AdvancementList.Listener" newName="net.minecraft.advancements.AdvancementList.IListener" type="class" />
<entry oldName="net.minecraft.advancements.RequirementsStrategy" newName="net.minecraft.advancements.IRequirementsStrategy" type="class" />
<entry oldName="net.minecraft.advancements.criterion.AbstractCriterionInstance" newName="net.minecraft.advancements.criterion.CriterionInstance" type="class" />
<entry oldName="net.minecraft.block.Block.EnumOffsetType" newName="net.minecraft.block.Block.OffsetType" type="class" />
<entry oldName="net.minecraft.block.BlockAbstractBanner" newName="net.minecraft.block.AbstractBannerBlock" type="class" />