Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View snobu's full-sized avatar

Adrian Calinescu snobu

View GitHub Profile
@snobu
snobu / gist:7dbee9a5fc43c6c664b73409bb2f7f88
Created February 28, 2020 20:01 — forked from UplandsDynamic/gist:8210e210f3cfab0200450db5a91c5ccc
Javascript (Typescript): Remove empty properties from object
deleteEmptyProps(obj: any): any {
// modifies passed obj in place, removing empty properties (inc. empty arrays)
return Object.keys(obj).forEach(k => {
if (!obj[k] || obj[k] === undefined ||
Array.isArray(obj[k]) && obj[k].length === 0) {
delete obj[k];
}
});
}
@snobu
snobu / udp_server.py
Created October 4, 2019 13:35 — forked from majek/udp_server.py
Simple python udp server
import logging
import socket
log = logging.getLogger('udp_server')
def udp_server(host='127.0.0.1', port=1234):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# apt-get install
sudo apt-get update
# For ubuntu 14.04
sudo apt-get install -y xserver-xorg-video-dummy-lts-trusty
# For ubuntu 16.04
sudo apt-get install -y xserver-xorg-video-dummy-lts-willy
# Copy the xorg.conf to `/etc/X11/xorg.conf`.
wget -P /etc/X11 https://gist.githubusercontent.com/mangoliou/ba126832f2fb8f86cc5b956355346038/raw/b6ad063711226fdd6413189ad905943750d64fd8/xorg.conf
@snobu
snobu / Fit Layer To Canvas.jsx
Last active March 8, 2018 13:35 — forked from jawinn/Fit Layer To Canvas.jsx
Fit Layer To Canvas - Photoshop Script
// FIT LAYER TO CANVAS
// via https://forums.adobe.com/message/5413957#5413957
var maintainAspectRatio = true; // set to true to keep aspect ratio
if (app.documents.length>0){
app.activeDocument.suspendHistory ('Fit Layer to Canvas', 'FitLayerToCanvas('+maintainAspectRatio+')');
}
function FitLayerToCanvas(keepAspect) {
@snobu
snobu / gist:e56df03584afc84d29ced8670c6b355c
Last active September 20, 2017 10:05 — forked from webarthur/gist:0ed27fbf811bbcc94e7c7c476b5d8f91
Force apt-get to IPv4 because sometimes you just have to
sudo echo "Acquire::ForceIPv4 \"true\";" > /etc/apt/apt.conf.d/99force-ipv4
@snobu
snobu / web.config
Created April 10, 2017 05:55 — forked from KristofferBerge/web.config
Configuration file for Azure web app to support angular2 applications with routing and long urls for auth tokens.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="32768"/>
</requestFiltering>