Skip to content

Instantly share code, notes, and snippets.

View Illutax's full-sized avatar

Valerij Dobler Illutax

  • WPS - Workplace Solutions GmbH
  • Hamburg
View GitHub Profile
@randalfien
randalfien / MegaSnap
Last active October 1, 2020 17:08
Unity MegaSnap
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SnapUtils
{
[MenuItem("Tools/Megasnap")]
private static void Snap()
{
GameObject[] rootObjects = SceneManager.GetSceneAt(0).GetRootGameObjects();
@zed
zed / cat.py
Last active July 6, 2017 00:13
cat(1) in Python 3
#!/usr/bin/env python3
"""`cat` for Python 3.
- if a file has no newline at the end then the last line is merged
with the first line of the next file like `cat` does
- os.fsencode() is not used to encode error message therefore there
could be surrogates in the output (encoded using the default for
errors 'backslashreplace' error handler): it is always possible to
restore the original filename whatever (ascii-based) locale
@mdamien
mdamien / gist:9273931
Last active February 6, 2022 22:24
Android POST request with Basic Auth
Log.d(TAG, "API CALL: POST "+url);
OutputStream output = null;
try {
String query = "furnail_name=hell&hi=2";//use URLEncode here
URLConnection connection = new URL("https://your-url.com/action/save").openConnection();
String authString = "Basic " + Base64.encodeToString((username + ":" + password).getBytes(),Base64.NO_WRAP);
connection.setRequestProperty("Authorization", authString);
connection.setDoOutput(true);
connection.setRequestProperty("Accept-Charset", "UTF-8");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + "UTF-8");
@willurd
willurd / web-servers.md
Last active July 19, 2024 02:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@sakti
sakti / SimpleSecureHTTPServer.py
Created December 21, 2010 11:24
simple secure http server using python
'''
SimpleSecureHTTPServer.py - simple HTTP server supporting SSL.
- replace fpem with the location of your .pem server file.
- the default port is 443.
usage: python SimpleSecureHTTPServer.py
Credit: https://code.activestate.com/recipes/442473-simple-http-server-supporting-ssl-secure-communica/
License: PSF License