Skip to content

Instantly share code, notes, and snippets.

View varrix's full-sized avatar

Logan Speck varrix

  • Ontario, Canada
  • 08:12 (UTC -04:00)
View GitHub Profile
@varrix
varrix / curl_your_depots.sh
Created May 30, 2017 05:35
curl all your repositories
curl -u [[USERNAME]] -s https://api.github.com/users/[[USERNAME]]/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@varrix
varrix / keybase.md
Created May 30, 2017 04:50
keybase

Keybase proof

I hereby claim:

  • I am varrix on github.
  • I am varrix (https://keybase.io/varrix) on keybase.
  • I have a public key ASCYzqhF8E92oTl7Ao0UE3XrIbo-kDIMnXcGIeQFWbCzvAo

To claim this, I am signing this object:

// this method will test the concurrency of HashMap#keySet()#remove() with enhanced for-loops
public void testKeySetRemovalConcurrency() {
Map<String, String> testMap = new HashMap<>();
testMap.put("testKey", "testValue");
System.out.println("Before use of enhanced for-loop and a Set view #remove() operation: " + testMap.toString());
// we want to specifically test the HashMap#keySet() with removal operations in a enhanced for-loop
for(String value : testMap.keySet()) {
@varrix
varrix / donkey-reddit-r-slash-commandline.txt
Created November 18, 2016 01:21
reddit.com/r/commandline 's donkey ascii art
^__^
(OO)\_______
(__)\ )\/\
||----w |
|| ||
def bubbleSort(alist):
for passnum in range(len(alist)-1,0,-1):
for i in range(passnum):
if alist[i]>alist[i+1]:
temp = alist[i]
alist[i] = alist[i+1]
alist[i+1] = temp
alist = [54,26,93,17,77,31,44,55,20]
bubbleSort(alist)
def shortBubbleSort(alist):
exchanges = True
passnum = len(alist)-1
while passnum > 0 and exchanges:
exchanges = False
for i in range(passnum):
if alist[i]>alist[i+1]:
exchanges = True
temp = alist[i]
alist[i] = alist[i+1]
@varrix
varrix / SimpleEscape.java
Created April 10, 2016 19:53
Simple no-dependency character sequence matching using quotations in Java. Source: http://stackoverflow.com/a/1473198
public static void main(String[] args) {
String line = "/cmd \"test\"";
Pattern p = Pattern.compile("\"([^\"]*)\"");
Matcher m = p.matcher(line);
while (m.find()) {
System.out.println(m.group(1));
}
}
@varrix
varrix / UUIDs.java
Last active December 15, 2016 05:47
/**
* Retrieve a UUID safely from a {@link String}.
*
* @param string The {@link String} to deserialize into an {@link UUID} object.
* @return {@link Optional#empty()} if the provided {@link String} is illegal, otherwise an {@link Optional}
* containing the deserialized {@link UUID} object.
*/
public static Optional<UUID> getUUID(String string) {
if (string.contains("-")) {
try {

firewalld

Permanently add service: firewall-cmd --permanent --add-service=http (Must restart service to take effect!)

Other

@varrix
varrix / apache.conf
Created July 5, 2015 21:54
Default apache.conf for phpyMyAdmin. Source: http://stackoverflow.com/a/19817403
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options Indexes FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off