Skip to content

Instantly share code, notes, and snippets.

Avatar

Georg schorschii

View GitHub Profile
@groz
groz / sync-http.swift
Created Feb 15, 2018
Synchronous http request in Swift
View sync-http.swift
import Foundation
func query(address: String) -> String {
let url = URL(string: address)
let semaphore = DispatchSemaphore(value: 0)
var result: String = ""
let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
result = String(data: data!, encoding: String.Encoding.utf8)!
@lightrush
lightrush / README.md
Created Nov 3, 2017
X11vnc Systemd Unit File
View README.md

X11vnc Systemd Unit File

This Systemd unit file starts X11VNC on boot

  1. Set VNC password: sudo x11vnc -storepasswd [YOUR VNC PASSWORD] /etc/x11vnc.passwd
  2. Install Systemd Unit File
sudo cp [path to]/vnc.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable vnc.service
@exabrial
exabrial / FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP.md
Last active Nov 5, 2018
FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP
View FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP.md

FreeRadius, PEAP-MSCHAP, Samba, Ubuntu 14.04, ActiveDirectory, LDAP

Why This guide

@mildmojo
mildmojo / rotate_desktop.sh
Created Jun 18, 2014
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
View rotate_desktop.sh
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@tott
tott / ip_in_range.php
Created Nov 27, 2013
php check if IP is in given network range
View ip_in_range.php
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@djaiss
djaiss / gist:2938259
Created Jun 15, 2012
PHP List of countries
View gist:2938259
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",