This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Wait for MemAvailable to be bigger than a certain value. | |
# | |
# $1 - Value in kb that MemAvailable should be greater than. | |
# $2 - (Optional, Default=60) Timeout in seconds | |
# | |
# Examples | |
# | |
# wait_for_mem_available 10000000 120 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding: utf-8 | |
import time | |
from flask import Flask, make_response | |
from waitress import serve | |
import random | |
app = Flask(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ch = curl_init("https://www.airbnb.de/calendar/ical/XYZ"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_FAILONERROR, true); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.xml.bind.JAXBContext; | |
import javax.xml.bind.Unmarshaller; | |
import javax.xml.bind.annotation.XmlElement; | |
import javax.xml.bind.annotation.XmlElementWrapper; | |
import javax.xml.bind.annotation.XmlRootElement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const self = require('sdk/self'); | |
const chrome = require('chrome'); | |
/** | |
* Autoupdate this addon on startup | |
*/ | |
(function() { | |
let AddonManager = chrome.Cu.import('resource://gre/modules/AddonManager.jsm', null).AddonManager; | |
AddonManager.getAddonByID(self.id, function(addon) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class Example { | |
public static void main(String[] args) { | |
String result = StringReplacer.replace("Hello World!", Pattern.compile("\\d+"), m -> ("" + (Integer.parseInt(m.group()) * 2)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sets the hidden file attribute of a file | |
* @param {String} filepath String holding the path of the file to hide | |
* @returns {Boolean} true if file attribute hidden is set, else false | |
*/ | |
function setWindowsFileAttributeHidden(filepath) { | |
const FILE_ATTRIBUTE_HIDDEN = 0x00000002; | |
try { | |
chrome.Cu.import('resource://gre/modules/ctypes.jsm'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Shows Filepicker dialog and uploads the chosen file to the given url | |
* | |
* @param url URL where the file is sent | |
* @param successHandler Success callback function | |
* @param errorHandler Error callback function | |
* @see https://developer.mozilla.org/en-US/docs/Web/API/FormData | |
*/ | |
function uploadFile(url, successHandler, progressHandler, errorHandler) { | |
var $fileInput = $('<input type=file>'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String toISO8601UTC(Date date) { | |
TimeZone tz = TimeZone.getTimeZone("UTC"); | |
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); | |
df.setTimeZone(tz); | |
return df.format(date); | |
} | |
public static Date fromISO8601UTC(String dateStr) { | |
TimeZone tz = TimeZone.getTimeZone("UTC"); | |
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); |